drivers: power: report battery voltage in AOSP compatible format
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / Documentation / cputopology.txt
CommitLineData
69dcc991 1
663fb2fc 2Export CPU topology info via sysfs. Items (attributes) are similar
69dcc991
ZY
3to /proc/cpuinfo.
4
51) /sys/devices/system/cpu/cpuX/topology/physical_package_id:
663fb2fc
AC
6
7 physical package id of cpuX. Typically corresponds to a physical
8 socket number, but the actual value is architecture and platform
9 dependent.
10
69dcc991 112) /sys/devices/system/cpu/cpuX/topology/core_id:
663fb2fc
AC
12
13 the CPU core ID of cpuX. Typically it is the hardware platform's
14 identifier (rather than the kernel's). The actual value is
15 architecture and platform dependent.
16
b40d8ed4
HC
173) /sys/devices/system/cpu/cpuX/topology/book_id:
18
19 the book ID of cpuX. Typically it is the hardware platform's
20 identifier (rather than the kernel's). The actual value is
21 architecture and platform dependent.
22
234) /sys/devices/system/cpu/cpuX/topology/thread_siblings:
663fb2fc
AC
24
25 internel kernel map of cpuX's hardware threads within the same
26 core as cpuX
27
b40d8ed4 285) /sys/devices/system/cpu/cpuX/topology/core_siblings:
663fb2fc
AC
29
30 internal kernel map of cpuX's hardware threads within the same
31 physical_package_id.
69dcc991 32
b40d8ed4
HC
336) /sys/devices/system/cpu/cpuX/topology/book_siblings:
34
35 internal kernel map of cpuX's hardware threads within the same
36 book_id.
37
69dcc991 38To implement it in an architecture-neutral way, a new source file,
b40d8ed4
HC
39drivers/base/topology.c, is to export the 4 or 6 attributes. The two book
40related sysfs files will only be created if CONFIG_SCHED_BOOK is selected.
69dcc991 41
c50cbb05
BH
42For an architecture to support this feature, it must define some of
43these macros in include/asm-XXX/topology.h:
69dcc991
ZY
44#define topology_physical_package_id(cpu)
45#define topology_core_id(cpu)
b40d8ed4 46#define topology_book_id(cpu)
fbd59a8d
RR
47#define topology_thread_cpumask(cpu)
48#define topology_core_cpumask(cpu)
b40d8ed4 49#define topology_book_cpumask(cpu)
69dcc991
ZY
50
51The type of **_id is int.
fbd59a8d 52The type of siblings is (const) struct cpumask *.
69dcc991 53
c50cbb05
BH
54To be consistent on all architectures, include/linux/topology.h
55provides default definitions for any of the above macros that are
56not defined by include/asm-XXX/topology.h:
571) physical_package_id: -1
582) core_id: 0
593) thread_siblings: just the given CPU
604) core_siblings: just the given CPU
d62720ad 61
b40d8ed4
HC
62For architectures that don't support books (CONFIG_SCHED_BOOK) there are no
63default definitions for topology_book_id() and topology_book_cpumask().
64
663fb2fc 65Additionally, CPU topology information is provided under
d62720ad
MT
66/sys/devices/system/cpu and includes these files. The internal
67source for the output is in brackets ("[]").
68
663fb2fc 69 kernel_max: the maximum CPU index allowed by the kernel configuration.
d62720ad
MT
70 [NR_CPUS-1]
71
663fb2fc 72 offline: CPUs that are not online because they have been
d62720ad 73 HOTPLUGGED off (see cpu-hotplug.txt) or exceed the limit
663fb2fc 74 of CPUs allowed by the kernel configuration (kernel_max
d62720ad
MT
75 above). [~cpu_online_mask + cpus >= NR_CPUS]
76
663fb2fc 77 online: CPUs that are online and being scheduled [cpu_online_mask]
d62720ad 78
663fb2fc 79 possible: CPUs that have been allocated resources and can be
d62720ad
MT
80 brought online if they are present. [cpu_possible_mask]
81
663fb2fc 82 present: CPUs that have been identified as being present in the
d62720ad
MT
83 system. [cpu_present_mask]
84
85The format for the above output is compatible with cpulist_parse()
86[see <linux/cpumask.h>]. Some examples follow.
87
663fb2fc 88In this example, there are 64 CPUs in the system but cpus 32-63 exceed
d62720ad 89the kernel max which is limited to 0..31 by the NR_CPUS config option
663fb2fc 90being 32. Note also that CPUs 2 and 4-31 are not online but could be
d62720ad
MT
91brought online as they are both present and possible.
92
93 kernel_max: 31
94 offline: 2,4-31,32-63
95 online: 0-1,3
96 possible: 0-31
97 present: 0-31
98
99In this example, the NR_CPUS config option is 128, but the kernel was
663fb2fc
AC
100started with possible_cpus=144. There are 4 CPUs in the system and cpu2
101was manually taken offline (and is the only CPU that can be brought
d62720ad
MT
102online.)
103
104 kernel_max: 127
105 offline: 2,4-127,128-143
106 online: 0-1,3
107 possible: 0-127
108 present: 0-3
109
110See cpu-hotplug.txt for the possible_cpus=NUM kernel start parameter
663fb2fc 111as well as more information on the various cpumasks.