Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cpu/topology: Export die_id

Export die_id in cpu topology, for the benefit of hardware that has
multiple-die/package.

Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: linux-doc@vger.kernel.org
Link: https://lkml.kernel.org/r/e7d1caaf4fbd24ee40db6d557ab28d7d83298900.1557769318.git.len.brown@intel.com

authored by

Len Brown and committed by
Thomas Gleixner
0e344d8c 14d96d6c

+19 -3
+12 -3
Documentation/cputopology.txt
··· 12 12 socket number, but the actual value is architecture and platform 13 13 dependent. 14 14 15 + die_id: 16 + 17 + the CPU die ID of cpuX. Typically it is the hardware platform's 18 + identifier (rather than the kernel's). The actual value is 19 + architecture and platform dependent. 20 + 15 21 core_id: 16 22 17 23 the CPU core ID of cpuX. Typically it is the hardware platform's ··· 87 81 these macros in include/asm-XXX/topology.h:: 88 82 89 83 #define topology_physical_package_id(cpu) 84 + #define topology_die_id(cpu) 90 85 #define topology_core_id(cpu) 91 86 #define topology_book_id(cpu) 92 87 #define topology_drawer_id(cpu) ··· 106 99 not defined by include/asm-XXX/topology.h: 107 100 108 101 1) topology_physical_package_id: -1 109 - 2) topology_core_id: 0 110 - 3) topology_sibling_cpumask: just the given CPU 111 - 4) topology_core_cpumask: just the given CPU 102 + 2) topology_die_id: -1 103 + 3) topology_core_id: 0 104 + 4) topology_sibling_cpumask: just the given CPU 105 + 5) topology_core_cpumask: just the given CPU 106 + 6) topology_die_cpumask: just the given CPU 112 107 113 108 For architectures that don't support books (CONFIG_SCHED_BOOK) there are no 114 109 default definitions for topology_book_id() and topology_book_cpumask().
+4
drivers/base/topology.c
··· 43 43 define_id_show_func(physical_package_id); 44 44 static DEVICE_ATTR_RO(physical_package_id); 45 45 46 + define_id_show_func(die_id); 47 + static DEVICE_ATTR_RO(die_id); 48 + 46 49 define_id_show_func(core_id); 47 50 static DEVICE_ATTR_RO(core_id); 48 51 ··· 75 72 76 73 static struct attribute *default_attrs[] = { 77 74 &dev_attr_physical_package_id.attr, 75 + &dev_attr_die_id.attr, 78 76 &dev_attr_core_id.attr, 79 77 &dev_attr_thread_siblings.attr, 80 78 &dev_attr_thread_siblings_list.attr,
+3
include/linux/topology.h
··· 184 184 #ifndef topology_physical_package_id 185 185 #define topology_physical_package_id(cpu) ((void)(cpu), -1) 186 186 #endif 187 + #ifndef topology_die_id 188 + #define topology_die_id(cpu) ((void)(cpu), -1) 189 + #endif 187 190 #ifndef topology_core_id 188 191 #define topology_core_id(cpu) ((void)(cpu), 0) 189 192 #endif