[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH RFC 5/6] i386/acpi: Fix SRAT ranges in accordance to usable IOVA
From: |
Joao Martins |
Subject: |
[PATCH RFC 5/6] i386/acpi: Fix SRAT ranges in accordance to usable IOVA |
Date: |
Tue, 22 Jun 2021 16:49:04 +0100 |
On configurations that lead to the creation of an SRAT with PXM entries
(-numa ...) because E820 and SRAT do not match, Linux tends to ignore
the ranges from SRAT, thus breaking NUMA topology in the guest.
When we start adding the ranges after 4G hole, use the newly added
iterator in add_srat_region() to create the SRAT PXM entries for the
usable GPA regions.
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
---
hw/i386/acpi-build.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 796ffc6f5c40..bb0918025296 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -57,6 +57,7 @@
#include "hw/acpi/pcihp.h"
#include "hw/i386/fw_cfg.h"
#include "hw/i386/ich9.h"
+#include "hw/i386/pc.h"
#include "hw/pci/pci_bus.h"
#include "hw/pci-host/q35.h"
#include "hw/i386/x86-iommu.h"
@@ -1872,6 +1873,23 @@ build_tpm_tcpa(GArray *table_data, BIOSLinker *linker,
GArray *tcpalog,
#define HOLE_640K_START (640 * KiB)
#define HOLE_640K_END (1 * MiB)
+static hwaddr add_srat_memory(hwaddr base, hwaddr size, GArray *table_data,
+ int pxm)
+{
+ AcpiSratMemoryAffinity *numamem;
+ hwaddr start, region_size;
+ struct GPARange *range;
+ uint32_t index;
+
+ for_each_usable_range(index, base, size, range, start, region_size) {
+ numamem = acpi_data_push(table_data, sizeof *numamem);
+ build_srat_memory(numamem, start, region_size, pxm,
+ MEM_AFFINITY_ENABLED);
+ }
+
+ return start + region_size;
+}
+
static void
build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)
{
@@ -1967,9 +1985,7 @@ build_srat(GArray *table_data, BIOSLinker *linker,
MachineState *machine)
}
if (mem_len > 0) {
- numamem = acpi_data_push(table_data, sizeof *numamem);
- build_srat_memory(numamem, mem_base, mem_len, i - 1,
- MEM_AFFINITY_ENABLED);
+ next_base = add_srat_memory(mem_base, mem_len, table_data, i - 1);
}
}
--
2.17.1
[PATCH RFC 3/6] pc/cmos: Adjust CMOS above 4G memory size according to 1Tb boundary, Joao Martins, 2021/06/22
[PATCH RFC 4/6] i386/pc: Keep PCI 64-bit hole within usable IOVA space, Joao Martins, 2021/06/22
[PATCH RFC 5/6] i386/acpi: Fix SRAT ranges in accordance to usable IOVA,
Joao Martins <=
[PATCH RFC 6/6] i386/pc: Add a machine property for AMD-only enforcing of valid IOVAs, Joao Martins, 2021/06/22
Re: [PATCH RFC 0/6] i386/pc: Fix creation of >= 1Tb guests on AMD systems with IOMMU, Alex Williamson, 2021/06/22