Page MenuHomeFreeBSD

D57692.id.diff
No OneTemporary

D57692.id.diff

diff --git a/sys/dev/acpica/acpi_pxm.c b/sys/dev/acpica/acpi_pxm.c
--- a/sys/dev/acpica/acpi_pxm.c
+++ b/sys/dev/acpica/acpi_pxm.c
@@ -315,8 +315,14 @@
gicc->AcpiProcessorUid, gicc->ProximityDomain,
(gicc->Flags & ACPI_SRAT_GICC_ENABLED) ?
"enabled" : "disabled");
- if (!(gicc->Flags & ACPI_SRAT_GICC_ENABLED))
- break;
+ /*
+ * Trust MADT for CPU existence. If the CPU is disabled in SRAT,
+ * we still add it to the topology so that if it is enabled in
+ * MADT and starts, it has a domain assigned (defaulting to the
+ * domain specified in the SRAT entry, usually 0).
+ */
+ printf("SRAT: CPU %u is disabled in SRAT, trusting MADT\n",
+ gicc->AcpiProcessorUid);
KASSERT(cpu_find(gicc->AcpiProcessorUid) == NULL,
("Duplicate CPU UID %u", gicc->AcpiProcessorUid));
cpup = cpu_add(gicc->AcpiProcessorUid, gicc->ProximityDomain);
@@ -526,7 +532,8 @@
int
acpi_pxm_init(int ncpus, vm_paddr_t maxphys)
{
- unsigned int idx, size;
+ int idx;
+ unsigned int size;
vm_paddr_t addr;
if (resource_disabled("srat", 0))
@@ -542,18 +549,25 @@
/*
* Allocate data structure:
*
- * Find the last physical memory region and steal some memory from
- * it. This is done because at this point in the boot process
- * malloc is still not usable.
+ * Find a physical memory region with enough space and steal
+ * some memory from it. This is done because at this point in
+ * the boot process malloc is still not usable.
*/
for (idx = 0; phys_avail[idx + 1] != 0; idx += 2);
KASSERT(idx != 0, ("phys_avail is empty!"));
idx -= 2;
size = sizeof(*cpus) * max_cpus;
+ for (; idx >= 0; idx -= 2) {
+ if (phys_avail[idx + 1] - phys_avail[idx] >= size)
+ break;
+ }
+ if (idx < 0) {
+ printf("SRAT: Not enough memory in any region for SRAT table items, disabling SRAT\n");
+ srat_physaddr = 0;
+ return (-1);
+ }
addr = trunc_page(phys_avail[idx + 1] - size);
- KASSERT(addr >= phys_avail[idx],
- ("Not enough memory for SRAT table items"));
phys_avail[idx + 1] = addr - 1;
/*

File Metadata

Mime Type
text/plain
Expires
Thu, Jul 2, 2:25 AM (3 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34260640
Default Alt Text
D57692.id.diff (2 KB)

Event Timeline