[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 26/27] pc: ACPI BIOS: reserve SRAT entry for hotplug
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [PATCH 26/27] pc: ACPI BIOS: reserve SRAT entry for hotplug mem hole |
Date: |
Thu, 21 Nov 2013 03:38:47 +0100 |
Needed for Windows to use hotplugged memory device, otherwise
it complains that server is not configured for memory hotplug.
Tests shows that aftewards it uses dynamically provided
proximity value from _PXM() method if available.
Signed-off-by: Igor Mammedov <address@hidden>
---
hw/i386/acpi-build.c | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 86c1372..ab8e923 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -50,6 +50,7 @@
#include "qapi/qmp/qint.h"
#include "qom/qom-qobject.h"
+#include "hw/mem/dimm.h"
typedef struct AcpiCpuInfo {
DECLARE_BITMAP(found_cpus, MAX_CPUMASK_BITS + 1);
@@ -1058,6 +1059,31 @@ acpi_build_srat_memory(AcpiSratMemoryAffinity *numamem,
uint64_t base,
numamem->range_length = cpu_to_le64(len);
}
+typedef struct {
+ AcpiSratMemoryAffinity **numamem;
+ GArray *table_data;
+} AcpiSratHotplugMemoryArg;
+
+static int acpi_add_hotplug_memory_region_entry(Object *obj, void *opaque)
+{
+ AcpiSratHotplugMemoryArg *arg = opaque;
+ DimmBus *bus = (DimmBus *)object_dynamic_cast(obj, TYPE_DIMM_BUS);
+
+ if (bus) {
+ uint64_t size = memory_region_size(&bus->as);
+ if (size) {
+ *arg->numamem = acpi_data_push(arg->table_data,
+ sizeof **arg->numamem);
+ acpi_build_srat_memory(*arg->numamem, bus->base, size, 0,
+ HOT_PLUGGABLE_MEM | ENABLED_MEM);
+ }
+ }
+
+ object_child_foreach(obj, acpi_add_hotplug_memory_region_entry,
+ opaque);
+ return 0;
+}
+
static void
build_srat(GArray *table_data, GArray *linker,
AcpiCpuInfo *cpu, PcGuestInfo *guest_info)
@@ -1133,6 +1159,13 @@ build_srat(GArray *table_data, GArray *linker,
acpi_build_srat_memory(numamem, 0, 0, 0, NOFLAGS_MEM);
}
+ {
+ AcpiSratHotplugMemoryArg arg = { .numamem = &numamem,
+ .table_data = table_data };
+ object_child_foreach(qdev_get_machine(),
+ acpi_add_hotplug_memory_region_entry, &arg);
+ }
+
build_header(linker, table_data,
(void *)(table_data->data + srat_start),
ACPI_SRAT_SIGNATURE,
--
1.7.1
- Re: [Qemu-devel] [PATCH 21/27] pc: add memory hotplug 440fx machine, (continued)
Re: [Qemu-devel] [PATCH 21/27] pc: add memory hotplug 440fx machine, Gerd Hoffmann, 2013/11/22
[Qemu-devel] [PATCH 22/27] pc: add memory hotplug Q35 machine, Igor Mammedov, 2013/11/20
[Qemu-devel] [PATCH 23/27] pc: ACPI BIOS: implement memory hotplug interface, Igor Mammedov, 2013/11/20
[Qemu-devel] [PATCH 24/27] pc: ACPI BIOS: add ssdt-mem.hex.generated and update ssdt-misc.hex.generated, Igor Mammedov, 2013/11/20
[Qemu-devel] [PATCH 25/27] pc: ACPI BIOS: use enum for defining memory affinity flags, Igor Mammedov, 2013/11/20
[Qemu-devel] [PATCH 26/27] pc: ACPI BIOS: reserve SRAT entry for hotplug mem hole,
Igor Mammedov <=
[Qemu-devel] [PATCH 27/27] pc: ACPI BIOS: make GPE.3 handle memory hotplug event on PIIX and Q35 machines, Igor Mammedov, 2013/11/20
Re: [Qemu-devel] [PATCH 00/27 RFC v7] ACPI memory hotplug, Michael S. Tsirkin, 2013/11/21