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.

Dependency Surface

Detected Declarations

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

Implementation Notes