blob: b61cb9564023b6dc878246fac760280c670d5ccf [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
17If one architecture wants to support this feature, it just needs to
18implement 4 defines, typically in file include/asm-XXX/topology.h.
19The 4 defines are:
20#define topology_physical_package_id(cpu)
21#define topology_core_id(cpu)
22#define topology_thread_siblings(cpu)
23#define topology_core_siblings(cpu)
24
25The type of **_id is int.
26The type of siblings is cpumask_t.
27
28To be consistent on all architectures, the 4 attributes should have
Matt LaPlantefff92892006-10-03 22:47:42 +020029default values if their values are unavailable. Below is the rule.
Zhang, Yanmin69dcc992006-02-03 03:04:36 -0800301) physical_package_id: If cpu has no physical package id, -1 is the
31default value.
322) core_id: If cpu doesn't support multi-core, its core id is 0.
333) thread_siblings: Just include itself, if the cpu doesn't support
34HT/multi-thread.
354) core_siblings: Just include itself, if the cpu doesn't support
36multi-core and HT/Multi-thread.
37
38So be careful when declaring the 4 defines in include/asm-XXX/topology.h.
39
40If an attribute isn't defined on an architecture, it won't be exported.
41