Blame SOURCES/kvm-Revert-hw-acpi-build-build-SRAT-memory-affinity-stru.patch

ae23c9
From c07dfca3b340161294755691f416ab20f37fa7c3 Mon Sep 17 00:00:00 2001
ae23c9
From: Igor Mammedov <imammedo@redhat.com>
ae23c9
Date: Thu, 4 Oct 2018 10:31:31 +0100
ae23c9
Subject: [PATCH 01/17] Revert "hw/acpi-build: build SRAT memory affinity
ae23c9
 structures for DIMM devices"
ae23c9
ae23c9
RH-Author: Igor Mammedov <imammedo@redhat.com>
ae23c9
Message-id: <1538649091-70517-1-git-send-email-imammedo@redhat.com>
ae23c9
Patchwork-id: 82373
ae23c9
O-Subject: [RHEL8/virt-8.0.0 qemu-kvm PATCH] Revert "hw/acpi-build: build SRAT memory affinity structures for DIMM devices"
ae23c9
Bugzilla: 1609235
ae23c9
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
ae23c9
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
ae23c9
RH-Acked-by: Thomas Huth <thuth@redhat.com>
ae23c9
ae23c9
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1609235
ae23c9
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=18630981
ae23c9
Upstream: RHEL only
ae23c9
ae23c9
Since upstream commits
ae23c9
 (0efd7e108 "pc: acpi: fix memory hotplug regression by reducing stub SRAT entry size")
ae23c9
 (dbb6da8ba7 "pc: acpi: revert back to 1 SRAT entry for hotpluggable area")
ae23c9
hasn't been backported to RHEL8, it's sufficient to revert commit
ae23c9
 (848a1cc1e8 "hw/acpi-build: build SRAT memory affinity structures for DIMM devices")
ae23c9
for the result to  match the current upstream state and fix the bug.
ae23c9
ae23c9
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
---
ae23c9
 hw/i386/acpi-build.c | 56 ++++------------------------------------------------
ae23c9
 1 file changed, 4 insertions(+), 52 deletions(-)
ae23c9
ae23c9
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
ae23c9
index b309a97..a175a8a 100644
ae23c9
--- a/hw/i386/acpi-build.c
ae23c9
+++ b/hw/i386/acpi-build.c
ae23c9
@@ -2253,55 +2253,6 @@ build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog)
ae23c9
 #define HOLE_640K_START  (640 * 1024)
ae23c9
 #define HOLE_640K_END   (1024 * 1024)
ae23c9
 
ae23c9
-static void build_srat_hotpluggable_memory(GArray *table_data, uint64_t base,
ae23c9
-                                           uint64_t len, int default_node)
ae23c9
-{
ae23c9
-    MemoryDeviceInfoList *info_list = qmp_pc_dimm_device_list();
ae23c9
-    MemoryDeviceInfoList *info;
ae23c9
-    MemoryDeviceInfo *mi;
ae23c9
-    PCDIMMDeviceInfo *di;
ae23c9
-    uint64_t end = base + len, cur, size;
ae23c9
-    bool is_nvdimm;
ae23c9
-    AcpiSratMemoryAffinity *numamem;
ae23c9
-    MemoryAffinityFlags flags;
ae23c9
-
ae23c9
-    for (cur = base, info = info_list;
ae23c9
-         cur < end;
ae23c9
-         cur += size, info = info->next) {
ae23c9
-        numamem = acpi_data_push(table_data, sizeof *numamem);
ae23c9
-
ae23c9
-        if (!info) {
ae23c9
-            build_srat_memory(numamem, cur, end - cur, default_node,
ae23c9
-                              MEM_AFFINITY_HOTPLUGGABLE | MEM_AFFINITY_ENABLED);
ae23c9
-            break;
ae23c9
-        }
ae23c9
-
ae23c9
-        mi = info->value;
ae23c9
-        is_nvdimm = (mi->type == MEMORY_DEVICE_INFO_KIND_NVDIMM);
ae23c9
-        di = !is_nvdimm ? mi->u.dimm.data : mi->u.nvdimm.data;
ae23c9
-
ae23c9
-        if (cur < di->addr) {
ae23c9
-            build_srat_memory(numamem, cur, di->addr - cur, default_node,
ae23c9
-                              MEM_AFFINITY_HOTPLUGGABLE | MEM_AFFINITY_ENABLED);
ae23c9
-            numamem = acpi_data_push(table_data, sizeof *numamem);
ae23c9
-        }
ae23c9
-
ae23c9
-        size = di->size;
ae23c9
-
ae23c9
-        flags = MEM_AFFINITY_ENABLED;
ae23c9
-        if (di->hotpluggable) {
ae23c9
-            flags |= MEM_AFFINITY_HOTPLUGGABLE;
ae23c9
-        }
ae23c9
-        if (is_nvdimm) {
ae23c9
-            flags |= MEM_AFFINITY_NON_VOLATILE;
ae23c9
-        }
ae23c9
-
ae23c9
-        build_srat_memory(numamem, di->addr, size, di->node, flags);
ae23c9
-    }
ae23c9
-
ae23c9
-    qapi_free_MemoryDeviceInfoList(info_list);
ae23c9
-}
ae23c9
-
ae23c9
 static void
ae23c9
 build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)
ae23c9
 {
ae23c9
@@ -2413,9 +2364,10 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)
ae23c9
      * providing _PXM method if necessary.
ae23c9
      */
ae23c9
     if (hotplugabble_address_space_size) {
ae23c9
-        build_srat_hotpluggable_memory(table_data, pcms->hotplug_memory.base,
ae23c9
-                                       hotplugabble_address_space_size,
ae23c9
-                                       pcms->numa_nodes - 1);
ae23c9
+        numamem = acpi_data_push(table_data, sizeof *numamem);
ae23c9
+        build_srat_memory(numamem, pcms->hotplug_memory.base,
ae23c9
+                          hotplugabble_address_space_size, pcms->numa_nodes - 1,
ae23c9
+                          MEM_AFFINITY_HOTPLUGGABLE | MEM_AFFINITY_ENABLED);
ae23c9
     }
ae23c9
 
ae23c9
     build_header(linker, table_data,
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9