[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 21/26] hw: acpi: reduced: Add memory hotplug support
From: |
Samuel Ortiz |
Subject: |
[Qemu-devel] [PATCH 21/26] hw: acpi: reduced: Add memory hotplug support |
Date: |
Mon, 22 Oct 2018 20:36:51 +0200 |
From: Yang Zhong <address@hidden>
We add the memory hotplug AML code to the hardware-reduced DSDT.
The memory hotplug event is handled through the GED device.
Cc: "Michael S. Tsirkin" <address@hidden>
Cc: Igor Mammedov <address@hidden>
Signed-off-by: Yang Zhong <address@hidden>
---
hw/acpi/reduced.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/hw/acpi/reduced.c b/hw/acpi/reduced.c
index 53b57760eb..33d413a255 100644
--- a/hw/acpi/reduced.c
+++ b/hw/acpi/reduced.c
@@ -33,6 +33,7 @@
#include "hw/acpi/cpu.h"
#include "hw/acpi/pc-hotplug.h"
#include "hw/acpi/reduced.h"
+#include "hw/acpi/memory_hotplug.h"
#include "hw/nvram/fw_cfg.h"
@@ -46,7 +47,16 @@
#include "migration/vmstate.h"
-#define GED_DEVICE "GED"
+#define GED_DEVICE "GED"
+#define CPU_SCAN_METHOD "CSCN"
+#define MEMORY_SLOT_SCAN_METHOD "MSCN"
+
+static void acpi_dsdt_add_memory_hotplug(MachineState *ms, Aml *dsdt)
+{
+ uint32_t nr_mem = ms->ram_slots;
+
+ build_memory_hotplug_aml(dsdt, nr_mem, "\\_SB", NULL);
+}
static void acpi_dsdt_add_cpus(MachineState *ms, Aml *dsdt, Aml *scope,
int smp_cpus, AcpiConfiguration *conf)
@@ -85,6 +95,7 @@ static void build_dsdt(MachineState *ms,
if (pci_host->pci_bus) {
acpi_dsdt_add_pci_bus(dsdt, pci_host);
}
+ acpi_dsdt_add_memory_hotplug(ms, dsdt);
acpi_dsdt_add_cpus(ms, dsdt, scope, smp_cpus, conf);
acpi_dsdt_add_ged(dsdt, conf);
aml_append(dsdt, scope);
@@ -283,8 +294,6 @@ void acpi_reduced_setup(MachineState *machine,
AcpiConfiguration *conf)
acpi_build_tables_cleanup(&tables, false);
}
-#define CPU_SCAN_METHOD "CSCN"
-
static Aml *ged_event_aml(GedEvent *event)
{
if (!event) {
@@ -296,6 +305,8 @@ static Aml *ged_event_aml(GedEvent *event)
/* We run a complete CPU SCAN when getting a CPU hotplug event */
return aml_call0("\\_SB.CPUS." CPU_SCAN_METHOD);
case GED_MEMORY_HOTPLUG:
+ /* We run a complete memory SCAN when getting a memory hotplug event */
+ return aml_call0("\\_SB.MHPC." MEMORY_SLOT_SCAN_METHOD);
case GED_PCI_HOTPLUG:
case GED_NVDIMM_HOTPLUG:
/* Not supported for now */
--
2.17.2
- [Qemu-devel] [PATCH 12/26] hw: acpi: Export the SRAT AML build API, (continued)
- [Qemu-devel] [PATCH 12/26] hw: acpi: Export the SRAT AML build API, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 09/26] hw: acpi: Export the MCFG getter, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 08/26] hw: acpi: Export and generalize the PCI host AML API, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 14/26] hw: acpi: Export the PCI hotplug API, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 15/26] hw: acpi: Retrieve the PCI bus from AcpiPciHpState, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 16/26] hw: fw-build: Add firmware build methods and state, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 17/26] hw: i386: Convert PC machine type to firmware build methods, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 19/26] hw: acpi: reduced: Add MCFG support, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 18/26] hw: acpi: Initial hardware-reduced support, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 20/26] hw: acpi: reduced: Generic Event Device support, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 21/26] hw: acpi: reduced: Add memory hotplug support,
Samuel Ortiz <=
- [Qemu-devel] [PATCH 24/26] hw: acpi: reduced: Add SRAT table, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 23/26] hw: acpi: reduced: Add reboot support, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 25/26] hw: acpi: reduced: Add NFIT support, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 22/26] hw: acpi: reduced: Add shutdown support, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 26/26] hw: acpi: reduced: Add PCI hotplug support, Samuel Ortiz, 2018/10/22
- Re: [Qemu-devel] [PATCH 00/27] ACPI hardware-reduced support, Michael S. Tsirkin, 2018/10/22
- Re: [Qemu-devel] [PATCH 00/27] ACPI hardware-reduced support, Peter Maydell, 2018/10/23