x86/cpu: Move logical package and die IDs into topology info
authorThomas Gleixner <tglx@linutronix.de>
Mon, 14 Aug 2023 08:18:37 +0000 (10:18 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 10 Oct 2023 12:38:18 +0000 (14:38 +0200)
Yet another topology related data pair. Rename logical_proc_id to
logical_pkg_id so it fits the common naming conventions.

No functional change.

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 <mikelley@microsoft.com>
Tested-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Zhang Rui <rui.zhang@intel.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20230814085112.745139505@linutronix.de
Documentation/arch/x86/topology.rst
arch/x86/events/intel/uncore.c
arch/x86/include/asm/processor.h
arch/x86/include/asm/topology.h
arch/x86/kernel/cpu/common.c
arch/x86/kernel/smpboot.c

index ff36e52091d944f97e3d273d098d5bdb101fa19a..88f29bab3ba1cc4631a67c706a6396622df88e28 100644 (file)
@@ -67,7 +67,7 @@ Package-related topology information in the kernel:
     Modern systems use this value for the socket. There may be multiple
     packages within a socket. This value may differ from topo.die_id.
 
-  - cpuinfo_x86.logical_proc_id:
+  - cpuinfo_x86.topo.logical_pkg_id:
 
     The logical ID of the package. As we do not trust BIOSes to enumerate the
     packages in a consistent way, we introduced the concept of logical package
index 69043e02e8a7d828ec2f096ba940648c5c3f39ea..01023aa5125bbc8ea82e2d3394789796b65e8936 100644 (file)
@@ -74,7 +74,7 @@ int uncore_device_to_die(struct pci_dev *dev)
                struct cpuinfo_x86 *c = &cpu_data(cpu);
 
                if (c->initialized && cpu_to_node(cpu) == node)
-                       return c->logical_die_id;
+                       return c->topo.logical_die_id;
        }
 
        return -1;
index 517d0bc319e4bb6c94b4520553ea9b725c514c38..b2cf309eed99eb96fc38a7b9f21aefa30752d98c 100644 (file)
@@ -95,6 +95,10 @@ struct cpuinfo_topology {
 
        // Core ID relative to the package
        u32                     core_id;
+
+       // Logical ID mappings
+       u32                     logical_pkg_id;
+       u32                     logical_die_id;
 };
 
 struct cpuinfo_x86 {
@@ -145,10 +149,6 @@ struct cpuinfo_x86 {
        u16                     x86_clflush_size;
        /* number of cores as seen by the OS: */
        u16                     booted_cores;
-       /* Logical processor id: */
-       u16                     logical_proc_id;
-       /* Core id: */
-       u16                     logical_die_id;
        /* Index into per_cpu list: */
        u16                     cpu_index;
        /*  Is SMT active on this core? */
index 7fa567c1f593010604163618f7c57b40ad8cc6d9..ac0c274bd10691414d2f716c1d6a4bc7e97926ef 100644 (file)
@@ -105,9 +105,9 @@ static inline void setup_node_to_cpumask_map(void) { }
 extern const struct cpumask *cpu_coregroup_mask(int cpu);
 extern const struct cpumask *cpu_clustergroup_mask(int cpu);
 
-#define topology_logical_package_id(cpu)       (cpu_data(cpu).logical_proc_id)
+#define topology_logical_package_id(cpu)       (cpu_data(cpu).topo.logical_pkg_id)
 #define topology_physical_package_id(cpu)      (cpu_data(cpu).topo.pkg_id)
-#define topology_logical_die_id(cpu)           (cpu_data(cpu).logical_die_id)
+#define topology_logical_die_id(cpu)           (cpu_data(cpu).topo.logical_die_id)
 #define topology_die_id(cpu)                   (cpu_data(cpu).topo.die_id)
 #define topology_core_id(cpu)                  (cpu_data(cpu).topo.core_id)
 #define topology_ppin(cpu)                     (cpu_data(cpu).ppin)
index 106b27f29aa9ab6d699eae9c1a387afcb8755de3..052bd792c6d15ce173ebfe64ffa5757a28848eaf 100644 (file)
@@ -1810,7 +1810,7 @@ static void validate_apic_and_package_id(struct cpuinfo_x86 *c)
        BUG_ON(topology_update_package_map(c->topo.pkg_id, cpu));
        BUG_ON(topology_update_die_map(c->topo.die_id, cpu));
 #else
-       c->logical_proc_id = 0;
+       c->topo.logical_pkg_id = 0;
 #endif
 }
 
index 17b86f4dbe66c1eb1739bbbb596cdeabd720d42d..82a30d0f58d9029703574dbdbfd410141ca8e20f 100644 (file)
@@ -340,7 +340,7 @@ int topology_phys_to_logical_pkg(unsigned int phys_pkg)
                struct cpuinfo_x86 *c = &cpu_data(cpu);
 
                if (c->initialized && c->topo.pkg_id == phys_pkg)
-                       return c->logical_proc_id;
+                       return c->topo.logical_pkg_id;
        }
        return -1;
 }
@@ -362,7 +362,7 @@ static int topology_phys_to_logical_die(unsigned int die_id, unsigned int cur_cp
 
                if (c->initialized && c->topo.die_id == die_id &&
                    c->topo.pkg_id == proc_id)
-                       return c->logical_die_id;
+                       return c->topo.logical_die_id;
        }
        return -1;
 }
@@ -387,7 +387,7 @@ int topology_update_package_map(unsigned int pkg, unsigned int cpu)
                        cpu, pkg, new);
        }
 found:
-       cpu_data(cpu).logical_proc_id = new;
+       cpu_data(cpu).topo.logical_pkg_id = new;
        return 0;
 }
 /**
@@ -410,7 +410,7 @@ int topology_update_die_map(unsigned int die, unsigned int cpu)
                        cpu, die, new);
        }
 found:
-       cpu_data(cpu).logical_die_id = new;
+       cpu_data(cpu).topo.logical_die_id = new;
        return 0;
 }