blob: bd699da246666a503195ed0d8240fb531b90f746 [file] [log] [blame]
Zhang, Yanmin69dcc992006-02-03 03:04:36 -08001
Jesper Juhlded23ac2006-03-28 01:56:52 -08002Export cpu topology info via sysfs. Items (attributes) are similar
Zhang, Yanmin69dcc992006-02-03 03:04:36 -08003to /proc/cpuinfo.
4
51) /sys/devices/system/cpu/cpuX/topology/physical_package_id:
6represent the physical package id of cpu X;
72) /sys/devices/system/cpu/cpuX/topology/core_id:
8represent the cpu core id to cpu X;
93) /sys/devices/system/cpu/cpuX/topology/thread_siblings:
10represent the thread siblings to cpu X in the same core;
114) /sys/devices/system/cpu/cpuX/topology/core_siblings:
12represent the thread siblings to cpu X in the same physical package;
13
14To implement it in an architecture-neutral way, a new source file,
Jesper Juhlded23ac2006-03-28 01:56:52 -080015drivers/base/topology.c, is to export the 4 attributes.
Zhang, Yanmin69dcc992006-02-03 03:04:36 -080016
Ben Hutchingsc50cbb02008-06-04 21:47:29 -070017For an architecture to support this feature, it must define some of
18these macros in include/asm-XXX/topology.h:
Zhang, Yanmin69dcc992006-02-03 03:04:36 -080019#define topology_physical_package_id(cpu)
20#define topology_core_id(cpu)
21#define topology_thread_siblings(cpu)
22#define topology_core_siblings(cpu)
23
24The type of **_id is int.
25The type of siblings is cpumask_t.
26
Ben Hutchingsc50cbb02008-06-04 21:47:29 -070027To be consistent on all architectures, include/linux/topology.h
28provides default definitions for any of the above macros that are
29not defined by include/asm-XXX/topology.h:
301) physical_package_id: -1
312) core_id: 0
323) thread_siblings: just the given CPU
334) core_siblings: just the given CPU