MFC r341741-r341742


MFC r341741-r341742

x86/acpica/srat.c: Add API for parsing proximity tables

The SLIT and SRAT ACPI tables needs to be parsed on arm64 as well, on
systems that use UEFI/ACPI firmware and support NUMA. To do this, we
need to move most of the logic of x86/acpica/srat.c to dev/acpica and
provide an API that architectures can use to parse and configure ACPI
NUMA information.

This commit adds the API in srat.c as a first step, without making any
functional changes. We will move the common code to sys/dev/acpica
as the next step.

The functions added are:

  • int acpi_pxm_init(int ncpus, vm_paddr_t maxphys) - to allocate and initialize data structures used
  • void acpi_pxm_parse_tables(void) - parse SRAT/SLIT, save the cpu and memory proximity information
  • void acpi_pxm_set_mem_locality(void) - use the saved data to set memory locality
  • void acpi_pxm_set_cpu_locality(void) - use the saved data to set cpu locality
  • void acpi_pxm_free(void) - free data structures allocated by init

On arm64, we do not have an cpu APIC id that can be used as index to
store CPU data, we need to use the Processor Uid. To help with this,
define internal functions cpu_add, cpu_find, cpu_get_info to store
and get CPU proximity information.

Reviewed by: markj, jhb (previous version)
Differential Revision: https://reviews.freebsd.org/D17940

acpica : move SRAT/SLIT parsing to sys/dev/acpica

This moves the architecture independent parts of sys/x86/acpica/srat.c
to sys/dev/acpica/acpi_pxm.c, to be used later on arm64. The function
declarations are moved to sys/dev/acpica/acpivar.h

We also need to update sys/conf/files.{i386,amd64} to use the new file.
No functional changes.

Reviewed by: markj, imp
Differential Revision: https://reviews.freebsd.org/D17941


jchandraAuthored on
Differential Revision
D17940: x86/acpica/srat.c: Add API for parsing proximity tables
rS352495: Add some tests for page fault signals and codes