summaryrefslogtreecommitdiff
path: root/arch/x86/include/asm/amd_node.h
diff options
context:
space:
mode:
authorYazen Ghannam <yazen.ghannam@amd.com>2025-01-07 22:28:41 +0000
committerBorislav Petkov (AMD) <bp@alien8.de>2025-01-08 10:49:20 +0100
commitbc7b2e629e0c9251ba96d864a30d34d1497b1b1b (patch)
treea660d0c1df4d9f4bba8ff50d7bc7e7c8f97d3fd5 /arch/x86/include/asm/amd_node.h
parent40a5f6ffdfc8f8ed0d8c535dfa3733b31c66a88c (diff)
x86/amd_nb: Use topology info to get AMD node count
Currently, the total AMD node count is determined by searching and counting CPU/node devices using PCI IDs. However, AMD node information is already available through topology CPUID/MSRs. The recent topology rework has made this info easier to access. Replace the node counting code with a simple product of topology info. Every node/northbridge is expected to have a 'misc' device. Clear everything out if a 'misc' device isn't found on a node. Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/r/20250107222847.3300430-7-yazen.ghannam@amd.com
Diffstat (limited to 'arch/x86/include/asm/amd_node.h')
-rw-r--r--arch/x86/include/asm/amd_node.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/x86/include/asm/amd_node.h b/arch/x86/include/asm/amd_node.h
index 3f097dd479f8..419a0ad13ef2 100644
--- a/arch/x86/include/asm/amd_node.h
+++ b/arch/x86/include/asm/amd_node.h
@@ -25,4 +25,9 @@
struct pci_dev *amd_node_get_func(u16 node, u8 func);
struct pci_dev *amd_node_get_root(u16 node);
+static inline u16 amd_num_nodes(void)
+{
+ return topology_amd_nodes_per_pkg() * topology_max_packages();
+}
+
#endif /*_ASM_X86_AMD_NODE_H_*/