arch/x86/kernel/amd_node.c
Source file repositories/reference/linux-study-clean/arch/x86/kernel/amd_node.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/kernel/amd_node.c- Extension
.c- Size
- 7944 bytes
- Lines
- 317
- Domain
- Architecture Layer
- Bucket
- arch/x86
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/debugfs.hasm/amd/node.h
Detected Declarations
function Copyrightfunction amd_smn_readfunction amd_smn_readfunction amd_smn_writefunction amd_smn_hsmp_rdwrfunction smn_node_writefunction smn_node_showfunction smn_address_writefunction smn_address_showfunction smn_value_showfunction smn_value_writefunction amd_smn_enable_dfsfunction amd_smn_initmodule init amd_smn_initexport amd_smn_readexport amd_smn_writeexport amd_smn_hsmp_rdwr
Annotated Snippet
if (!pci_request_config_region_exclusive(root, 0, PCI_CFG_SPACE_SIZE, NULL)) {
pci_err(root, "Failed to reserve config space\n");
return -EEXIST;
}
num_roots++;
}
pr_debug("Found %d AMD root devices\n", num_roots);
if (!num_roots)
return -ENODEV;
num_nodes = amd_num_nodes();
amd_roots = kzalloc_objs(*amd_roots, num_nodes);
if (!amd_roots)
return -ENOMEM;
roots_per_node = num_roots / num_nodes;
count = 0;
node = 0;
root = NULL;
while (node < num_nodes && (root = get_next_root(root))) {
/* Use one root for each node and skip the rest. */
if (count++ % roots_per_node)
continue;
pci_dbg(root, "is root for AMD node %u\n", node);
amd_roots[node++] = root;
}
if (enable_dfs) {
debugfs_dir = debugfs_create_dir("amd_smn", arch_debugfs_dir);
debugfs_create_file("node", 0600, debugfs_dir, NULL, &smn_node_fops);
debugfs_create_file("address", 0600, debugfs_dir, NULL, &smn_address_fops);
debugfs_create_file("value", 0600, debugfs_dir, NULL, &smn_value_fops);
}
smn_exclusive = true;
return 0;
}
fs_initcall(amd_smn_init);
Annotation
- Immediate include surface: `linux/debugfs.h`, `asm/amd/node.h`.
- Detected declarations: `function Copyright`, `function amd_smn_read`, `function amd_smn_read`, `function amd_smn_write`, `function amd_smn_hsmp_rdwr`, `function smn_node_write`, `function smn_node_show`, `function smn_address_write`, `function smn_address_show`, `function smn_value_show`.
- Atlas domain: Architecture Layer / arch/x86.
- 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.