yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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