x86/cpu: Make topology_amd_node_id() use the actual node info
authorThomas Gleixner <tglx@linutronix.de>
Tue, 13 Feb 2024 21:04:18 +0000 (22:04 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 15 Feb 2024 21:07:38 +0000 (22:07 +0100)
Now that everything is converted switch it over and remove the intermediate
operation.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Juergen Gross <jgross@suse.com>
Tested-by: Sohil Mehta <sohil.mehta@intel.com>
Tested-by: Michael Kelley <mhklinux@outlook.com>
Tested-by: Zhang Rui <rui.zhang@intel.com>
Tested-by: Wang Wendy <wendy.wang@intel.com>
Tested-by: K Prateek Nayak <kprateek.nayak@amd.com>
Link: https://lore.kernel.org/r/20240212153625.334185785@linutronix.de
arch/x86/include/asm/topology.h
arch/x86/kernel/cpu/topology_common.c

index be27ef77d45e934e9609ac7477f26009d9710436..5d70618ca581beac9777d47fcb576d910762b299 100644 (file)
@@ -136,7 +136,7 @@ extern const struct cpumask *cpu_clustergroup_mask(int cpu);
 #define topology_core_id(cpu)                  (cpu_data(cpu).topo.core_id)
 #define topology_ppin(cpu)                     (cpu_data(cpu).ppin)
 
-#define topology_amd_node_id(cpu)              (cpu_data(cpu).topo.die_id)
+#define topology_amd_node_id(cpu)              (cpu_data(cpu).topo.amd_node_id)
 
 extern unsigned int __max_die_per_package;
 
@@ -172,7 +172,7 @@ extern unsigned int __amd_nodes_per_pkg;
 
 static inline unsigned int topology_amd_nodes_per_pkg(void)
 {
-       return __max_die_per_package;
+       return __amd_nodes_per_pkg;
 }
 
 extern struct cpumask __cpu_primary_thread_mask;
index ab944d6f973f90ff6c49688e02084e3760a6c7aa..afea34d59598f1b858a139557fd4d742cef4d339 100644 (file)
@@ -151,9 +151,7 @@ static void topo_set_ids(struct topo_scan *tscan)
        c->topo.core_id = (apicid & topo_domain_mask(TOPO_PKG_DOMAIN)) >>
                x86_topo_system.dom_shifts[TOPO_SMT_DOMAIN];
 
-       /* Temporary workaround */
-       if (tscan->amd_nodes_per_pkg)
-               c->topo.amd_node_id = c->topo.die_id = tscan->amd_node_id;
+       c->topo.amd_node_id = tscan->amd_node_id;
 
        if (c->x86_vendor == X86_VENDOR_AMD)
                cpu_topology_fixup_amd(tscan);
@@ -239,6 +237,5 @@ void __init cpu_init_topology(struct cpuinfo_x86 *c)
         * AMD systems have Nodes per package which cannot be mapped to
         * APIC ID.
         */
-       if (c->x86_vendor == X86_VENDOR_AMD || c->x86_vendor == X86_VENDOR_HYGON)
-               __amd_nodes_per_pkg = __max_die_per_package = tscan.amd_nodes_per_pkg;
+       __amd_nodes_per_pkg = tscan.amd_nodes_per_pkg;
 }