diff options
author | jhb <jhb@FreeBSD.org> | 2011-10-05 16:03:47 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2011-10-05 16:03:47 +0000 |
commit | 1448b25b0d172e1ba1ee2b75fb8e3a0e63babbdd (patch) | |
tree | c603ba5542f49886abcb2d89fceea310afc1abbd | |
parent | 1cb16d98872b7dcec16ad22150c6a1c95e4a0796 (diff) | |
download | FreeBSD-src-1448b25b0d172e1ba1ee2b75fb8e3a0e63babbdd.zip FreeBSD-src-1448b25b0d172e1ba1ee2b75fb8e3a0e63babbdd.tar.gz |
Ignore SRAT memory entries if the memory range does not overlap with an
existing phys_avail[] table. If a hw.physmem setting causes a memory
domain to not be present in phys_avail[], the SRAT table will now be
ignored rather than triggering a panic when a CPU in the missing domain
tries to allocate a page.
MFC after: 1 week
-rw-r--r-- | sys/x86/acpica/srat.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sys/x86/acpica/srat.c b/sys/x86/acpica/srat.c index 4b7df37..cd04f87 100644 --- a/sys/x86/acpica/srat.c +++ b/sys/x86/acpica/srat.c @@ -59,6 +59,26 @@ static vm_paddr_t srat_physaddr; static void srat_walk_table(acpi_subtable_handler *handler, void *arg); +/* + * Returns true if a memory range overlaps with at least one range in + * phys_avail[]. + */ +static int +overlaps_phys_avail(vm_paddr_t start, vm_paddr_t end) +{ + int i; + + for (i = 0; phys_avail[i] != 0 && phys_avail[i + 1] != 0; i += 2) { + if (phys_avail[i + 1] < start) + continue; + if (phys_avail[i] < end) + return (1); + break; + } + return (0); + +} + static void srat_parse_entry(ACPI_SUBTABLE_HEADER *entry, void *arg) { @@ -111,6 +131,12 @@ srat_parse_entry(ACPI_SUBTABLE_HEADER *entry, void *arg) "enabled" : "disabled"); if (!(mem->Flags & ACPI_SRAT_MEM_ENABLED)) break; + if (!overlaps_phys_avail(mem->BaseAddress, + mem->BaseAddress + mem->Length)) { + printf("SRAT: Ignoring memory at addr %jx\n", + (uintmax_t)mem->BaseAddress); + break; + } if (num_mem == VM_PHYSSEG_MAX) { printf("SRAT: Too many memory regions\n"); *(int *)arg = ENXIO; |