drivers/acpi/numa/srat.c
Source file repositories/reference/linux-study-clean/drivers/acpi/numa/srat.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/acpi/numa/srat.c- Extension
.c- Size
- 18520 bytes
- Lines
- 704
- Domain
- Driver Families
- Bucket
- drivers/acpi
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/init.hlinux/kernel.hlinux/types.hlinux/errno.hlinux/acpi.hlinux/memblock.hlinux/memory.hlinux/numa.hlinux/nodemask.hlinux/topology.hlinux/numa_memblks.hlinux/string_choices.h
Detected Declarations
function disable_sratfunction pxm_to_nodefunction node_to_pxmfunction __acpi_map_pxm_to_nodefunction acpi_map_pxm_to_nodefunction pxm_to_node_mapfunction acpi_table_print_srat_entryfunction slit_validfunction bad_sratfunction srat_disabledfunction numa_fill_memblksfunction acpi_parse_slitfunction acpi_parse_memory_affinityfunction acpi_parse_cfmwsfunction acpi_numa_x2apic_affinity_initfunction acpi_parse_x2apic_affinityfunction acpi_parse_processor_affinityfunction acpi_parse_gicc_affinityfunction acpi_parse_gi_affinityfunction acpi_parse_gi_affinityfunction acpi_parse_rintc_affinityfunction acpi_parse_sratfunction acpi_table_parse_sratfunction acpi_numa_initfunction acpi_node_backed_by_real_pxmfunction acpi_get_pxmfunction acpi_get_nodeexport pxm_to_nodeexport node_to_pxmexport acpi_map_pxm_to_nodeexport acpi_node_backed_by_real_pxmexport acpi_get_node
Annotated Snippet
if (node_to_pxm_map[i] != PXM_INVAL) {
for (j = 0; j <= max_nid; j++) {
if ((emu_nid_to_phys[j] == i) &&
WARN(node_to_pxm_map_copy[j] != PXM_INVAL,
"Node %d is already binded to PXM %d\n",
j, node_to_pxm_map_copy[j]))
return -1;
if (emu_nid_to_phys[j] == i) {
node_to_pxm_map_copy[j] =
node_to_pxm_map[i];
if (j > index)
index = j;
count++;
}
}
}
}
if (index == -1) {
pr_debug("No node/PXM mapping has been set\n");
/* nothing more to be done */
return 0;
}
if (WARN(index != max_nid, "%d max nid when expected %d\n",
index, max_nid))
return -1;
nodes_clear(nodes_to_enable);
/* map phys nodes not used for fake nodes */
for (i = 0; i < MAX_NUMNODES; i++) {
if (node_to_pxm_map[i] != PXM_INVAL) {
for (j = 0; j <= max_nid; j++)
if (emu_nid_to_phys[j] == i)
break;
/* fake nodes PXM mapping has been done */
if (j <= max_nid)
continue;
/* find first hole */
for (j = 0;
j < MAX_NUMNODES &&
node_to_pxm_map_copy[j] != PXM_INVAL;
j++)
;
if (WARN(j == MAX_NUMNODES,
"Number of nodes exceeds MAX_NUMNODES\n"))
return -1;
node_to_pxm_map_copy[j] = node_to_pxm_map[i];
node_set(j, nodes_to_enable);
count++;
}
}
/* creating reverse mapping in pxm_to_node_map[] */
for (i = 0; i < MAX_NUMNODES; i++)
if (node_to_pxm_map_copy[i] != PXM_INVAL &&
pxm_to_node_map_copy[node_to_pxm_map_copy[i]] == NUMA_NO_NODE)
pxm_to_node_map_copy[node_to_pxm_map_copy[i]] = i;
/* overwrite with new mapping */
for (i = 0; i < MAX_NUMNODES; i++) {
node_to_pxm_map[i] = node_to_pxm_map_copy[i];
pxm_to_node_map[i] = pxm_to_node_map_copy[i];
}
/* enable other nodes found in PXM for hotplug */
nodes_or(numa_nodes_parsed, nodes_to_enable, numa_nodes_parsed);
pr_debug("found %d total number of nodes\n", count);
return 0;
}
#endif
static void __init
acpi_table_print_srat_entry(struct acpi_subtable_header *header)
{
switch (header->type) {
case ACPI_SRAT_TYPE_CPU_AFFINITY:
{
struct acpi_srat_cpu_affinity *p =
(struct acpi_srat_cpu_affinity *)header;
pr_debug("SRAT Processor (id[0x%02x] eid[0x%02x]) in proximity domain %d %s\n",
p->apic_id, p->local_sapic_eid,
p->proximity_domain_lo,
str_enabled_disabled(p->flags & ACPI_SRAT_CPU_ENABLED));
}
break;
case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
{
struct acpi_srat_mem_affinity *p =
Annotation
- Immediate include surface: `linux/module.h`, `linux/init.h`, `linux/kernel.h`, `linux/types.h`, `linux/errno.h`, `linux/acpi.h`, `linux/memblock.h`, `linux/memory.h`.
- Detected declarations: `function disable_srat`, `function pxm_to_node`, `function node_to_pxm`, `function __acpi_map_pxm_to_node`, `function acpi_map_pxm_to_node`, `function pxm_to_node_map`, `function acpi_table_print_srat_entry`, `function slit_valid`, `function bad_srat`, `function srat_disabled`.
- Atlas domain: Driver Families / drivers/acpi.
- Implementation status: integration implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.