Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/acpica/acpi_pxm.c
Show First 20 Lines • Show All 622 Lines • ▼ Show 20 Lines | |||||
srat_walk_table(acpi_subtable_handler *handler, void *arg) | srat_walk_table(acpi_subtable_handler *handler, void *arg) | ||||
{ | { | ||||
acpi_walk_subtables(srat + 1, (char *)srat + srat->Header.Length, | acpi_walk_subtables(srat + 1, (char *)srat + srat->Header.Length, | ||||
handler, arg); | handler, arg); | ||||
} | } | ||||
/* | /* | ||||
* Setup per-CPU domain IDs from information saved in 'cpus'. | * Set up per-CPU domain IDs from information saved in 'cpus' and tear down data | ||||
* structures allocated by acpi_pxm_init(). | |||||
*/ | */ | ||||
void | void | ||||
acpi_pxm_set_cpu_locality(void) | acpi_pxm_set_cpu_locality(void) | ||||
{ | { | ||||
struct cpu_info *cpu; | struct cpu_info *cpu; | ||||
struct pcpu *pc; | struct pcpu *pc; | ||||
u_int i; | u_int i; | ||||
if (srat_physaddr == 0) | if (srat_physaddr == 0) | ||||
return; | return; | ||||
for (i = 0; i < MAXCPU; i++) { | for (i = 0; i < MAXCPU; i++) { | ||||
if (CPU_ABSENT(i)) | if (CPU_ABSENT(i)) | ||||
continue; | continue; | ||||
pc = pcpu_find(i); | pc = pcpu_find(i); | ||||
KASSERT(pc != NULL, ("no pcpu data for CPU %u", i)); | KASSERT(pc != NULL, ("no pcpu data for CPU %u", i)); | ||||
cpu = cpu_get_info(pc); | cpu = cpu_get_info(pc); | ||||
pc->pc_domain = vm_ndomains > 1 ? cpu->domain : 0; | pc->pc_domain = vm_ndomains > 1 ? cpu->domain : 0; | ||||
CPU_SET(i, &cpuset_domain[pc->pc_domain]); | CPU_SET(i, &cpuset_domain[pc->pc_domain]); | ||||
if (bootverbose) | if (bootverbose) | ||||
printf("SRAT: CPU %u has memory domain %d\n", i, | printf("SRAT: CPU %u has memory domain %d\n", i, | ||||
pc->pc_domain); | pc->pc_domain); | ||||
} | } | ||||
pmap_unmapbios((vm_offset_t)cpus, sizeof(*cpus) * max_cpus); | |||||
kib: What is the point of this unmap ? We still do not return stealed memory back. | |||||
Done Inline ActionsI guess it is just defensive, to help ensure that the cpus table is not used once the kernel has bootstrapped. markj: I guess it is just defensive, to help ensure that the cpus table is not used once the kernel… | |||||
Not Done Inline ActionsI think it would be nice to return the memory. kib: I think it would be nice to return the memory. | |||||
Done Inline ActionsTo do that we would need to create a new vm_phys_seg[] entry for the memory, which is going to be a single 4KB page on most systems. I guess that is fine since x86 is VM_PHYSSEG_DENSE, so vm_phys_paddr_to_vm_page() does not need to iterate over the entries. I will add an XXX comment for now. markj: To do that we would need to create a new vm_phys_seg[] entry for the memory, which is going to… | |||||
srat_physaddr = 0; | |||||
cpus = NULL; | |||||
} | } | ||||
int | int | ||||
acpi_pxm_get_cpu_locality(int apic_id) | acpi_pxm_get_cpu_locality(int apic_id) | ||||
{ | { | ||||
struct cpu_info *cpu; | struct cpu_info *cpu; | ||||
cpu = cpu_find(apic_id); | cpu = cpu_find(apic_id); | ||||
if (cpu == NULL) | if (cpu == NULL) | ||||
panic("SRAT: CPU with ID %u is not known", apic_id); | panic("SRAT: CPU with ID %u is not known", apic_id); | ||||
return (cpu->domain); | return (cpu->domain); | ||||
} | |||||
/* | |||||
* Free data structures allocated during acpi_pxm_init. | |||||
*/ | |||||
void | |||||
acpi_pxm_free(void) | |||||
{ | |||||
if (srat_physaddr == 0) | |||||
return; | |||||
pmap_unmapbios((vm_offset_t)cpus, sizeof(*cpus) * max_cpus); | |||||
srat_physaddr = 0; | |||||
cpus = NULL; | |||||
} | } | ||||
/* | /* | ||||
* Map a _PXM value to a VM domain ID. | * Map a _PXM value to a VM domain ID. | ||||
* | * | ||||
* Returns the domain ID, or -1 if no domain ID was found. | * Returns the domain ID, or -1 if no domain ID was found. | ||||
*/ | */ | ||||
int | int | ||||
Show All 22 Lines |
What is the point of this unmap ? We still do not return stealed memory back.