Lines Matching +full:cpu +full:- +full:centric
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
95 * This maps the SLIT data into the VM-domain centric view. in slit_parse_table()
97 * remap them to a VM-domain ID and if it doesn't exist, in slit_parse_table()
100 * It should result in a packed 2d array of VM-domain in slit_parse_table()
105 printf("SLIT.Localities: %d\n", (int) s->LocalityCount); in slit_parse_table()
106 for (i = 0; i < s->LocalityCount; i++) { in slit_parse_table()
113 for (j = 0; j < s->LocalityCount; j++) { in slit_parse_table()
117 e = s->Entry[i * s->LocalityCount + j]; in slit_parse_table()
122 vm_locality_table[offset] = -1; in slit_parse_table()
140 return (-1); in parse_slit()
145 return (-1); in parse_slit()
196 * Find CPU by processor ID (APIC ID on x86, Processor UID on arm64)
215 * Find CPU by pcpu pointer.
224 id = pc->pc_acpi_id; in cpu_get_info()
226 id = pc->pc_apic_id; in cpu_get_info()
230 panic("SRAT: CPU with ID %u is not known", id); in cpu_get_info()
235 * Add proximity information for a new CPU.
248 if (last_cpu >= max_cpus - 1) in cpu_add()
252 cpup->domain = domain; in cpu_add()
253 cpup->id = cpuid; in cpu_add()
254 cpup->enabled = 1; in cpu_add()
261 ACPI_SRAT_CPU_AFFINITY *cpu; in srat_parse_entry() local
269 switch (entry->Type) { in srat_parse_entry()
271 cpu = (ACPI_SRAT_CPU_AFFINITY *)entry; in srat_parse_entry()
272 domain = cpu->ProximityDomainLo | in srat_parse_entry()
273 cpu->ProximityDomainHi[0] << 8 | in srat_parse_entry()
274 cpu->ProximityDomainHi[1] << 16 | in srat_parse_entry()
275 cpu->ProximityDomainHi[2] << 24; in srat_parse_entry()
277 printf("SRAT: Found CPU APIC ID %u domain %d: %s\n", in srat_parse_entry()
278 cpu->ApicId, domain, in srat_parse_entry()
279 (cpu->Flags & ACPI_SRAT_CPU_ENABLED) ? in srat_parse_entry()
281 if (!(cpu->Flags & ACPI_SRAT_CPU_ENABLED)) in srat_parse_entry()
283 cpup = cpu_find(cpu->ApicId); in srat_parse_entry()
286 cpu->ApicId); in srat_parse_entry()
290 cpup = cpu_add(cpu->ApicId, domain); in srat_parse_entry()
293 cpu->ApicId); in srat_parse_entry()
298 printf("SRAT: Found CPU APIC ID %u domain %d: %s\n", in srat_parse_entry()
299 x2apic->ApicId, x2apic->ProximityDomain, in srat_parse_entry()
300 (x2apic->Flags & ACPI_SRAT_CPU_ENABLED) ? in srat_parse_entry()
302 if (!(x2apic->Flags & ACPI_SRAT_CPU_ENABLED)) in srat_parse_entry()
304 KASSERT(cpu_find(x2apic->ApicId) == NULL, in srat_parse_entry()
305 ("Duplicate local APIC ID %u", x2apic->ApicId)); in srat_parse_entry()
306 cpup = cpu_add(x2apic->ApicId, x2apic->ProximityDomain); in srat_parse_entry()
309 x2apic->ApicId); in srat_parse_entry()
314 printf("SRAT: Found CPU UID %u domain %d: %s\n", in srat_parse_entry()
315 gicc->AcpiProcessorUid, gicc->ProximityDomain, in srat_parse_entry()
316 (gicc->Flags & ACPI_SRAT_GICC_ENABLED) ? in srat_parse_entry()
318 if (!(gicc->Flags & ACPI_SRAT_GICC_ENABLED)) in srat_parse_entry()
320 KASSERT(cpu_find(gicc->AcpiProcessorUid) == NULL, in srat_parse_entry()
321 ("Duplicate CPU UID %u", gicc->AcpiProcessorUid)); in srat_parse_entry()
322 cpup = cpu_add(gicc->AcpiProcessorUid, gicc->ProximityDomain); in srat_parse_entry()
324 printf("SRAT: Ignoring CPU UID %u (too high)\n", in srat_parse_entry()
325 gicc->AcpiProcessorUid); in srat_parse_entry()
329 base = mem->BaseAddress; in srat_parse_entry()
330 length = mem->Length; in srat_parse_entry()
331 domain = mem->ProximityDomain; in srat_parse_entry()
337 (mem->Flags & ACPI_SRAT_MEM_ENABLED) ? in srat_parse_entry()
339 if (!(mem->Flags & ACPI_SRAT_MEM_ENABLED)) in srat_parse_entry()
361 mem_info[i].start -= length; in srat_parse_entry()
374 for (i = num_mem; i > slot; i--) in srat_parse_entry()
375 mem_info[i] = mem_info[i - 1]; in srat_parse_entry()
385 * Ensure each memory domain has at least one CPU and that each CPU
402 printf("SRAT: No CPU found for memory domain %d\n", in check_domains()
462 printf("SRAT: No memory region found for 0x%jx - 0x%jx\n", in check_phys_avail()
468 * Renumber the memory domains to be compact and zero-based if not
495 for (j = ndomain; j > slot; j--) in renumber_domains()
496 domain_pxm[j] = domain_pxm[j - 1]; in renumber_domains()
510 /* Walk the cpu[] and mem_info[] arrays to renumber. */ in renumber_domains()
524 * allocate space for cpu information, and initialize globals.
533 return (-1); in acpi_pxm_init()
536 last_cpu = -1; in acpi_pxm_init()
540 return (-1); in acpi_pxm_init()
551 idx -= 2; in acpi_pxm_init()
554 addr = trunc_page(phys_avail[idx + 1] - size); in acpi_pxm_init()
557 phys_avail[idx + 1] = addr - 1; in acpi_pxm_init()
586 return (-1); in parse_srat()
598 * For now, assume -1 == "no locality information for in init_mem_locality()
602 vm_locality_table[i] = -1; in init_mem_locality()
637 acpi_walk_subtables(srat + 1, (char *)srat + srat->Header.Length, in srat_walk_table()
642 * Set up per-CPU domain IDs from information saved in 'cpus' and tear down data
648 struct cpu_info *cpu; in acpi_pxm_set_cpu_locality() local
658 KASSERT(pc != NULL, ("no pcpu data for CPU %u", i)); in acpi_pxm_set_cpu_locality()
659 cpu = cpu_get_info(pc); in acpi_pxm_set_cpu_locality()
660 pc->pc_domain = vm_ndomains > 1 ? cpu->domain : 0; in acpi_pxm_set_cpu_locality()
661 CPU_SET(i, &cpuset_domain[pc->pc_domain]); in acpi_pxm_set_cpu_locality()
663 printf("SRAT: CPU %u has memory domain %d\n", i, in acpi_pxm_set_cpu_locality()
664 pc->pc_domain); in acpi_pxm_set_cpu_locality()
675 struct cpu_info *cpu; in acpi_pxm_get_cpu_locality() local
677 cpu = cpu_find(apic_id); in acpi_pxm_get_cpu_locality()
678 if (cpu == NULL) in acpi_pxm_get_cpu_locality()
679 panic("SRAT: CPU with ID %u is not known", apic_id); in acpi_pxm_get_cpu_locality()
680 return (cpu->domain); in acpi_pxm_get_cpu_locality()
686 * Returns the domain ID, or -1 if no domain ID was found.
698 return (-1); in acpi_map_pxm_to_vm_domainid()
707 return (-1); in acpi_map_pxm_to_vm_domainid()