summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-09-01 22:45:46 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-09-01 22:45:46 -0400
commitae982073095a44f004d7ffb9f271077abef9dbcf (patch)
tree26dfda416542c9dc60ab24029c16caecb964d627 /tools
parentf1a3c0b933e7ff856223d6fcd7456d403e54e4e5 (diff)
parente625ccec1fa6c24620f38fd72d5b2fd62230ad2b (diff)
Merge tag 'pm+acpi-4.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management and ACPI updates from Rafael Wysocki: "From the number of commits perspective, the biggest items are ACPICA and cpufreq changes with the latter taking the lead (over 50 commits). On the cpufreq front, there are many cleanups and minor fixes in the core and governors, driver updates etc. We also have a new cpufreq driver for Mediatek MT8173 chips. ACPICA mostly updates its debug infrastructure and adds a number of fixes and cleanups for a good measure. The Operating Performance Points (OPP) framework is updated with new DT bindings and support for them among other things. We have a few updates of the generic power domains framework and a reorganization of the ACPI device enumeration code and bus type operations. And a lot of fixes and cleanups all over. Included is one branch from the MFD tree as it contains some PM-related driver core and ACPI PM changes a few other commits are based on. Specifics: - ACPICA update to upstream revision 20150818 including method tracing extensions to allow more in-depth AML debugging in the kernel and a number of assorted fixes and cleanups (Bob Moore, Lv Zheng, Markus Elfring). - ACPI sysfs code updates and a documentation update related to AML method tracing (Lv Zheng). - ACPI EC driver fix related to serialized evaluations of _Qxx methods and ACPI tools updates allowing the EC userspace tool to be built from the kernel source (Lv Zheng). - ACPI processor driver updates preparing it for future introduction of CPPC support and ACPI PCC mailbox driver updates (Ashwin Chaugule). - ACPI interrupts enumeration fix for a regression related to the handling of IRQ attribute conflicts between MADT and the ACPI namespace (Jiang Liu). - Fixes related to ACPI device PM (Mika Westerberg, Srinidhi Kasagar). - ACPI device registration code reorganization to separate the sysfs-related code and bus type operations from the rest (Rafael J Wysocki). - Assorted cleanups in the ACPI core (Jarkko Nikula, Mathias Krause, Andy Shevchenko, Rafael J Wysocki, Nicolas Iooss). - ACPI cpufreq driver and ia64 cpufreq driver fixes and cleanups (Pan Xinhui, Rafael J Wysocki). - cpufreq core cleanups on top of the previous changes allowing it to preseve its sysfs directories over system suspend/resume (Viresh Kumar, Rafael J Wysocki, Sebastian Andrzej Siewior). - cpufreq fixes and cleanups related to governors (Viresh Kumar). - cpufreq updates (core and the cpufreq-dt driver) related to the turbo/boost mode support (Viresh Kumar, Bartlomiej Zolnierkiewicz). - New DT bindings for Operating Performance Points (OPP), support for them in the OPP framework and in the cpufreq-dt driver plus related OPP framework fixes and cleanups (Viresh Kumar). - cpufreq powernv driver updates (Shilpasri G Bhat). - New cpufreq driver for Mediatek MT8173 (Pi-Cheng Chen). - Assorted cpufreq driver (speedstep-lib, sfi, integrator) cleanups and fixes (Abhilash Jindal, Andrzej Hajda, Cristian Ardelean). - intel_pstate driver updates including Skylake-S support, support for enabling HW P-states per CPU and an additional vendor bypass list entry (Kristen Carlson Accardi, Chen Yu, Ethan Zhao). - cpuidle core fixes related to the handling of coupled idle states (Xunlei Pang). - intel_idle driver updates including Skylake Client support and support for freeze-mode-specific idle states (Len Brown). - Driver core updates related to power management (Andy Shevchenko, Rafael J Wysocki). - Generic power domains framework fixes and cleanups (Jon Hunter, Geert Uytterhoeven, Rajendra Nayak, Ulf Hansson). - Device PM QoS framework update to allow the latency tolerance setting to be exposed to user space via sysfs (Mika Westerberg). - devfreq support for PPMUv2 in Exynos5433 and a fix for an incorrect exynos-ppmu DT binding (Chanwoo Choi, Javier Martinez Canillas). - System sleep support updates (Alan Stern, Len Brown, SungEun Kim). - rockchip-io AVS support updates (Heiko Stuebner). - PM core clocks support fixup (Colin Ian King). - Power capping RAPL driver update including support for Skylake H/S and Broadwell-H (Radivoje Jovanovic, Seiichi Ikarashi). - Generic device properties framework fixes related to the handling of static (driver-provided) property sets (Andy Shevchenko). - turbostat and cpupower updates (Len Brown, Shilpasri G Bhat, Shreyas B Prabhu)" * tag 'pm+acpi-4.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (180 commits) cpufreq: speedstep-lib: Use monotonic clock cpufreq: powernv: Increase the verbosity of OCC console messages cpufreq: sfi: use kmemdup rather than duplicating its implementation cpufreq: drop !cpufreq_driver check from cpufreq_parse_governor() cpufreq: rename cpufreq_real_policy as cpufreq_user_policy cpufreq: remove redundant 'policy' field from user_policy cpufreq: remove redundant 'governor' field from user_policy cpufreq: update user_policy.* on success cpufreq: use memcpy() to copy policy cpufreq: remove redundant CPUFREQ_INCOMPATIBLE notifier event cpufreq: mediatek: Add MT8173 cpufreq driver dt-bindings: mediatek: Add MT8173 CPU DVFS clock bindings PM / Domains: Fix typo in description of genpd_dev_pm_detach() PM / Domains: Remove unusable governor dummies PM / Domains: Make pm_genpd_init() available to modules PM / domains: Align column headers and data in pm_genpd_summary output powercap / RAPL: disable the 2nd power limit properly tools: cpupower: Fix error when running cpupower monitor PM / OPP: Drop unlikely before IS_ERR(_OR_NULL) PM / OPP: Fix static checker warning (broken 64bit big endian systems) ...
Diffstat (limited to 'tools')
-rw-r--r--tools/power/acpi/Makefile168
-rw-r--r--tools/power/acpi/Makefile.config92
-rw-r--r--tools/power/acpi/Makefile.rules37
-rw-r--r--tools/power/acpi/tools/acpidump/Makefile53
-rw-r--r--tools/power/acpi/tools/ec/Makefile33
-rw-r--r--tools/power/cpupower/utils/cpufreq-set.c4
-rw-r--r--tools/power/cpupower/utils/helpers/topology.c2
-rw-r--r--tools/power/x86/turbostat/turbostat.85
-rw-r--r--tools/power/x86/turbostat/turbostat.c100
9 files changed, 307 insertions, 187 deletions
diff --git a/tools/power/acpi/Makefile b/tools/power/acpi/Makefile
index 3d1537b93c64..e882c8320135 100644
--- a/tools/power/acpi/Makefile
+++ b/tools/power/acpi/Makefile
@@ -8,154 +8,20 @@
8# as published by the Free Software Foundation; version 2 8# as published by the Free Software Foundation; version 2
9# of the License. 9# of the License.
10 10
11OUTPUT=./ 11include ../../scripts/Makefile.include
12ifeq ("$(origin O)", "command line") 12
13 OUTPUT := $(O)/ 13all: acpidump ec
14endif 14clean: acpidump_clean ec_clean
15 15install: acpidump_install ec_install
16ifneq ($(OUTPUT),) 16uninstall: acpidump_uninstall ec_uninstall
17# check that the output directory actually exists 17
18OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd) 18acpidump ec: FORCE
19$(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist)) 19 $(call descend,tools/$@,all)
20endif 20acpidump_clean ec_clean:
21 21 $(call descend,tools/$(@:_clean=),clean)
22SUBDIRS = tools/ec 22acpidump_install ec_install:
23 23 $(call descend,tools/$(@:_install=),install)
24# --- CONFIGURATION BEGIN --- 24acpidump_uninstall ec_uninstall:
25 25 $(call descend,tools/$(@:_uninstall=),uninstall)
26# Set the following to `true' to make a unstripped, unoptimized 26
27# binary. Leave this set to `false' for production use. 27.PHONY: FORCE
28DEBUG ?= true
29
30# make the build silent. Set this to something else to make it noisy again.
31V ?= false
32
33# Prefix to the directories we're installing to
34DESTDIR ?=
35
36# --- CONFIGURATION END ---
37
38# Directory definitions. These are default and most probably
39# do not need to be changed. Please note that DESTDIR is
40# added in front of any of them
41
42bindir ?= /usr/bin
43sbindir ?= /usr/sbin
44mandir ?= /usr/man
45
46# Toolchain: what tools do we use, and what options do they need:
47
48INSTALL = /usr/bin/install -c
49INSTALL_PROGRAM = ${INSTALL}
50INSTALL_DATA = ${INSTALL} -m 644
51INSTALL_SCRIPT = ${INSTALL_PROGRAM}
52
53# If you are running a cross compiler, you may want to set this
54# to something more interesting, like "arm-linux-". If you want
55# to compile vs uClibc, that can be done here as well.
56CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc-
57CC = $(CROSS)gcc
58LD = $(CROSS)gcc
59STRIP = $(CROSS)strip
60HOSTCC = gcc
61
62# check if compiler option is supported
63cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -x c /dev/null > /dev/null 2>&1; then echo "$(1)"; fi;}
64
65# use '-Os' optimization if available, else use -O2
66OPTIMIZATION := $(call cc-supports,-Os,-O2)
67
68WARNINGS := -Wall
69WARNINGS += $(call cc-supports,-Wstrict-prototypes)
70WARNINGS += $(call cc-supports,-Wdeclaration-after-statement)
71
72KERNEL_INCLUDE := ../../../include
73ACPICA_INCLUDE := ../../../drivers/acpi/acpica
74CFLAGS += -D_LINUX -I$(KERNEL_INCLUDE) -I$(ACPICA_INCLUDE)
75CFLAGS += $(WARNINGS)
76
77ifeq ($(strip $(V)),false)
78 QUIET=@
79 ECHO=@echo
80else
81 QUIET=
82 ECHO=@\#
83endif
84export QUIET ECHO
85
86# if DEBUG is enabled, then we do not strip or optimize
87ifeq ($(strip $(DEBUG)),true)
88 CFLAGS += -O1 -g -DDEBUG
89 STRIPCMD = /bin/true -Since_we_are_debugging
90else
91 CFLAGS += $(OPTIMIZATION) -fomit-frame-pointer
92 STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment
93endif
94
95# --- ACPIDUMP BEGIN ---
96
97vpath %.c \
98 ../../../drivers/acpi/acpica\
99 tools/acpidump\
100 common\
101 os_specific/service_layers
102
103CFLAGS += -DACPI_DUMP_APP -Itools/acpidump
104
105DUMP_OBJS = \
106 apdump.o\
107 apfiles.o\
108 apmain.o\
109 osunixdir.o\
110 osunixmap.o\
111 osunixxf.o\
112 tbprint.o\
113 tbxfroot.o\
114 utbuffer.o\
115 utdebug.o\
116 utexcep.o\
117 utglobal.o\
118 utmath.o\
119 utprint.o\
120 utstring.o\
121 utxferror.o\
122 oslibcfs.o\
123 oslinuxtbl.o\
124 cmfsize.o\
125 getopt.o
126
127DUMP_OBJS := $(addprefix $(OUTPUT)tools/acpidump/,$(DUMP_OBJS))
128
129$(OUTPUT)acpidump: $(DUMP_OBJS)
130 $(ECHO) " LD " $@
131 $(QUIET) $(LD) $(CFLAGS) $(LDFLAGS) $(DUMP_OBJS) -L$(OUTPUT) -o $@
132 $(QUIET) $(STRIPCMD) $@
133
134$(OUTPUT)tools/acpidump/%.o: %.c
135 $(ECHO) " CC " $@
136 $(QUIET) $(CC) -c $(CFLAGS) -o $@ $<
137
138# --- ACPIDUMP END ---
139
140all: $(OUTPUT)acpidump
141 echo $(OUTPUT)
142
143clean:
144 -find $(OUTPUT) \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \
145 | xargs rm -f
146 -rm -f $(OUTPUT)acpidump
147
148install-tools:
149 $(INSTALL) -d $(DESTDIR)${sbindir}
150 $(INSTALL_PROGRAM) $(OUTPUT)acpidump $(DESTDIR)${sbindir}
151
152install-man:
153 $(INSTALL_DATA) -D man/acpidump.8 $(DESTDIR)${mandir}/man8/acpidump.8
154
155install: all install-tools install-man
156
157uninstall:
158 - rm -f $(DESTDIR)${sbindir}/acpidump
159 - rm -f $(DESTDIR)${mandir}/man8/acpidump.8
160
161.PHONY: all utils install-tools install-man install uninstall clean
diff --git a/tools/power/acpi/Makefile.config b/tools/power/acpi/Makefile.config
new file mode 100644
index 000000000000..552af68d5414
--- /dev/null
+++ b/tools/power/acpi/Makefile.config
@@ -0,0 +1,92 @@
1# tools/power/acpi/Makefile.config - ACPI tool Makefile
2#
3# Copyright (c) 2015, Intel Corporation
4# Author: Lv Zheng <lv.zheng@intel.com>
5#
6# This program is free software; you can redistribute it and/or
7# modify it under the terms of the GNU General Public License
8# as published by the Free Software Foundation; version 2
9# of the License.
10
11include ../../../../scripts/Makefile.include
12
13OUTPUT=./
14ifeq ("$(origin O)", "command line")
15 OUTPUT := $(O)/
16endif
17
18ifneq ($(OUTPUT),)
19# check that the output directory actually exists
20OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd)
21$(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist))
22endif
23
24# --- CONFIGURATION BEGIN ---
25
26# Set the following to `true' to make a unstripped, unoptimized
27# binary. Leave this set to `false' for production use.
28DEBUG ?= true
29
30# make the build silent. Set this to something else to make it noisy again.
31V ?= false
32
33# Prefix to the directories we're installing to
34DESTDIR ?=
35
36# --- CONFIGURATION END ---
37
38# Directory definitions. These are default and most probably
39# do not need to be changed. Please note that DESTDIR is
40# added in front of any of them
41
42bindir ?= /usr/bin
43sbindir ?= /usr/sbin
44mandir ?= /usr/man
45
46# Toolchain: what tools do we use, and what options do they need:
47
48INSTALL = /usr/bin/install -c
49INSTALL_PROGRAM = ${INSTALL}
50INSTALL_DATA = ${INSTALL} -m 644
51INSTALL_SCRIPT = ${INSTALL_PROGRAM}
52
53# If you are running a cross compiler, you may want to set this
54# to something more interesting, like "arm-linux-". If you want
55# to compile vs uClibc, that can be done here as well.
56CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc-
57CC = $(CROSS)gcc
58LD = $(CROSS)gcc
59STRIP = $(CROSS)strip
60HOSTCC = gcc
61
62# check if compiler option is supported
63cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -x c /dev/null > /dev/null 2>&1; then echo "$(1)"; fi;}
64
65# use '-Os' optimization if available, else use -O2
66OPTIMIZATION := $(call cc-supports,-Os,-O2)
67
68WARNINGS := -Wall
69WARNINGS += $(call cc-supports,-Wstrict-prototypes)
70WARNINGS += $(call cc-supports,-Wdeclaration-after-statement)
71
72KERNEL_INCLUDE := ../../../include
73ACPICA_INCLUDE := ../../../drivers/acpi/acpica
74CFLAGS += -D_LINUX -I$(KERNEL_INCLUDE) -I$(ACPICA_INCLUDE)
75CFLAGS += $(WARNINGS)
76
77ifeq ($(strip $(V)),false)
78 QUIET=@
79 ECHO=@echo
80else
81 QUIET=
82 ECHO=@\#
83endif
84
85# if DEBUG is enabled, then we do not strip or optimize
86ifeq ($(strip $(DEBUG)),true)
87 CFLAGS += -O1 -g -DDEBUG
88 STRIPCMD = /bin/true -Since_we_are_debugging
89else
90 CFLAGS += $(OPTIMIZATION) -fomit-frame-pointer
91 STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment
92endif
diff --git a/tools/power/acpi/Makefile.rules b/tools/power/acpi/Makefile.rules
new file mode 100644
index 000000000000..ec87a9e562c0
--- /dev/null
+++ b/tools/power/acpi/Makefile.rules
@@ -0,0 +1,37 @@
1# tools/power/acpi/Makefile.rules - ACPI tool Makefile
2#
3# Copyright (c) 2015, Intel Corporation
4# Author: Lv Zheng <lv.zheng@intel.com>
5#
6# This program is free software; you can redistribute it and/or
7# modify it under the terms of the GNU General Public License
8# as published by the Free Software Foundation; version 2
9# of the License.
10
11$(OUTPUT)$(TOOL): $(TOOL_OBJS) FORCE
12 $(ECHO) " LD " $@
13 $(QUIET) $(LD) $(CFLAGS) $(LDFLAGS) $(TOOL_OBJS) -L$(OUTPUT) -o $@
14 $(QUIET) $(STRIPCMD) $@
15
16$(OUTPUT)%.o: %.c
17 $(ECHO) " CC " $@
18 $(QUIET) $(CC) -c $(CFLAGS) -o $@ $<
19
20all: $(OUTPUT)$(TOOL)
21clean:
22 -find $(OUTPUT) \( -not -type d \) \
23 -and \( -name '*~' -o -name '*.[oas]' \) \
24 -type f -print \
25 | xargs rm -f
26 -rm -f $(OUTPUT)$(TOOL)
27
28install-tools:
29 $(INSTALL) -d $(DESTDIR)${sbindir}
30 $(INSTALL_PROGRAM) $(OUTPUT)$(TOOL) $(DESTDIR)${sbindir}
31uninstall-tools:
32 - rm -f $(DESTDIR)${sbindir}/$(TOOL)
33
34install: all install-tools $(EXTRA_INSTALL)
35uninstall: uninstall-tools $(EXTRA_UNINSTALL)
36
37.PHONY: FORCE
diff --git a/tools/power/acpi/tools/acpidump/Makefile b/tools/power/acpi/tools/acpidump/Makefile
new file mode 100644
index 000000000000..8d761576e91b
--- /dev/null
+++ b/tools/power/acpi/tools/acpidump/Makefile
@@ -0,0 +1,53 @@
1# tools/power/acpi/tools/acpidump/Makefile - ACPI tool Makefile
2#
3# Copyright (c) 2015, Intel Corporation
4# Author: Lv Zheng <lv.zheng@intel.com>
5#
6# This program is free software; you can redistribute it and/or
7# modify it under the terms of the GNU General Public License
8# as published by the Free Software Foundation; version 2
9# of the License.
10
11include ../../Makefile.config
12
13TOOL = acpidump
14EXTRA_INSTALL = install-man
15EXTRA_UNINSTALL = uninstall-man
16
17vpath %.c \
18 ../../../../../drivers/acpi/acpica\
19 ./\
20 ../../common\
21 ../../os_specific/service_layers
22CFLAGS += -DACPI_DUMP_APP -I.\
23 -I../../../../../drivers/acpi/acpica\
24 -I../../../../../include
25TOOL_OBJS = \
26 apdump.o\
27 apfiles.o\
28 apmain.o\
29 osunixdir.o\
30 osunixmap.o\
31 osunixxf.o\
32 tbprint.o\
33 tbxfroot.o\
34 utbuffer.o\
35 utdebug.o\
36 utexcep.o\
37 utglobal.o\
38 utmath.o\
39 utnonansi.o\
40 utprint.o\
41 utstring.o\
42 utxferror.o\
43 oslibcfs.o\
44 oslinuxtbl.o\
45 cmfsize.o\
46 getopt.o
47
48include ../../Makefile.rules
49
50install-man: ../../man/acpidump.8
51 $(INSTALL_DATA) -D $< $(DESTDIR)${mandir}/man8/acpidump.8
52uninstall-man:
53 - rm -f $(DESTDIR)${mandir}/man8/acpidump.8
diff --git a/tools/power/acpi/tools/ec/Makefile b/tools/power/acpi/tools/ec/Makefile
index b7b0b929bd32..75d8a127b6ee 100644
--- a/tools/power/acpi/tools/ec/Makefile
+++ b/tools/power/acpi/tools/ec/Makefile
@@ -1,22 +1,17 @@
1ec_access: ec_access.o 1# tools/power/acpi/tools/acpidump/Makefile - ACPI tool Makefile
2 $(ECHO) " LD " $@ 2#
3 $(QUIET) $(LD) $(CFLAGS) $(LDFLAGS) $< -o $@ 3# Copyright (c) 2015, Intel Corporation
4 $(QUIET) $(STRIPCMD) $@ 4# Author: Lv Zheng <lv.zheng@intel.com>
5#
6# This program is free software; you can redistribute it and/or
7# modify it under the terms of the GNU General Public License
8# as published by the Free Software Foundation; version 2
9# of the License.
5 10
6%.o: %.c 11include ../../Makefile.config
7 $(ECHO) " CC " $@
8 $(QUIET) $(CC) -c $(CFLAGS) -o $@ $<
9 12
10all: ec_access 13TOOL = ec
14TOOL_OBJS = \
15 ec_access.o
11 16
12install: 17include ../../Makefile.rules
13 $(INSTALL) -d $(DESTDIR)${sbindir}
14 $(INSTALL_PROGRAM) ec_access $(DESTDIR)${sbindir}
15
16uninstall:
17 - rm -f $(DESTDIR)${sbindir}/ec_access
18
19clean:
20 -rm -f $(OUTPUT)ec_access
21
22.PHONY: all install uninstall
diff --git a/tools/power/cpupower/utils/cpufreq-set.c b/tools/power/cpupower/utils/cpufreq-set.c
index f656e585ed45..4e213576381e 100644
--- a/tools/power/cpupower/utils/cpufreq-set.c
+++ b/tools/power/cpupower/utils/cpufreq-set.c
@@ -17,6 +17,7 @@
17 17
18#include "cpufreq.h" 18#include "cpufreq.h"
19#include "helpers/helpers.h" 19#include "helpers/helpers.h"
20#include "helpers/sysfs.h"
20 21
21#define NORM_FREQ_LEN 32 22#define NORM_FREQ_LEN 32
22 23
@@ -318,6 +319,9 @@ int cmd_freq_set(int argc, char **argv)
318 cpufreq_cpu_exists(cpu)) 319 cpufreq_cpu_exists(cpu))
319 continue; 320 continue;
320 321
322 if (sysfs_is_cpu_online(cpu) != 1)
323 continue;
324
321 printf(_("Setting cpu: %d\n"), cpu); 325 printf(_("Setting cpu: %d\n"), cpu);
322 ret = do_one_cpu(cpu, &new_pol, freq, policychange); 326 ret = do_one_cpu(cpu, &new_pol, freq, policychange);
323 if (ret) { 327 if (ret) {
diff --git a/tools/power/cpupower/utils/helpers/topology.c b/tools/power/cpupower/utils/helpers/topology.c
index c13120af519b..cea398c176e7 100644
--- a/tools/power/cpupower/utils/helpers/topology.c
+++ b/tools/power/cpupower/utils/helpers/topology.c
@@ -73,6 +73,8 @@ int get_cpu_topology(struct cpupower_topology *cpu_top)
73 for (cpu = 0; cpu < cpus; cpu++) { 73 for (cpu = 0; cpu < cpus; cpu++) {
74 cpu_top->core_info[cpu].cpu = cpu; 74 cpu_top->core_info[cpu].cpu = cpu;
75 cpu_top->core_info[cpu].is_online = sysfs_is_cpu_online(cpu); 75 cpu_top->core_info[cpu].is_online = sysfs_is_cpu_online(cpu);
76 if (!cpu_top->core_info[cpu].is_online)
77 continue;
76 if(sysfs_topology_read_file( 78 if(sysfs_topology_read_file(
77 cpu, 79 cpu,
78 "physical_package_id", 80 "physical_package_id",
diff --git a/tools/power/x86/turbostat/turbostat.8 b/tools/power/x86/turbostat/turbostat.8
index 05b8fc38dc8b..622db685b4f9 100644
--- a/tools/power/x86/turbostat/turbostat.8
+++ b/tools/power/x86/turbostat/turbostat.8
@@ -251,11 +251,6 @@ Although it is not guaranteed by the architecture, turbostat assumes
251that they count at TSC rate, which is true on all processors tested to date. 251that they count at TSC rate, which is true on all processors tested to date.
252 252
253.SH REFERENCES 253.SH REFERENCES
254"Intel® Turbo Boost Technology
255in Intel® Core™ Microarchitecture (Nehalem) Based Processors"
256http://download.intel.com/design/processor/applnots/320354.pdf
257
258"Intel® 64 and IA-32 Architectures Software Developer's Manual
259Volume 3B: System Programming Guide" 254Volume 3B: System Programming Guide"
260http://www.intel.com/products/processor/manuals/ 255http://www.intel.com/products/processor/manuals/
261 256
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 323b65edfc97..9655cb49c7cb 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -372,7 +372,7 @@ void print_header(void)
372 if (do_rapl & RAPL_GFX) 372 if (do_rapl & RAPL_GFX)
373 outp += sprintf(outp, " GFX_J"); 373 outp += sprintf(outp, " GFX_J");
374 if (do_rapl & RAPL_DRAM) 374 if (do_rapl & RAPL_DRAM)
375 outp += sprintf(outp, " RAM_W"); 375 outp += sprintf(outp, " RAM_J");
376 if (do_rapl & RAPL_PKG_PERF_STATUS) 376 if (do_rapl & RAPL_PKG_PERF_STATUS)
377 outp += sprintf(outp, " PKG_%%"); 377 outp += sprintf(outp, " PKG_%%");
378 if (do_rapl & RAPL_DRAM_PERF_STATUS) 378 if (do_rapl & RAPL_DRAM_PERF_STATUS)
@@ -1157,7 +1157,7 @@ dump_nhm_platform_info(void)
1157 1157
1158 get_msr(base_cpu, MSR_NHM_PLATFORM_INFO, &msr); 1158 get_msr(base_cpu, MSR_NHM_PLATFORM_INFO, &msr);
1159 1159
1160 fprintf(stderr, "cpu0: MSR_NHM_PLATFORM_INFO: 0x%08llx\n", msr); 1160 fprintf(stderr, "cpu%d: MSR_NHM_PLATFORM_INFO: 0x%08llx\n", base_cpu, msr);
1161 1161
1162 ratio = (msr >> 40) & 0xFF; 1162 ratio = (msr >> 40) & 0xFF;
1163 fprintf(stderr, "%d * %.0f = %.0f MHz max efficiency frequency\n", 1163 fprintf(stderr, "%d * %.0f = %.0f MHz max efficiency frequency\n",
@@ -1168,8 +1168,8 @@ dump_nhm_platform_info(void)
1168 ratio, bclk, ratio * bclk); 1168 ratio, bclk, ratio * bclk);
1169 1169
1170 get_msr(base_cpu, MSR_IA32_POWER_CTL, &msr); 1170 get_msr(base_cpu, MSR_IA32_POWER_CTL, &msr);
1171 fprintf(stderr, "cpu0: MSR_IA32_POWER_CTL: 0x%08llx (C1E auto-promotion: %sabled)\n", 1171 fprintf(stderr, "cpu%d: MSR_IA32_POWER_CTL: 0x%08llx (C1E auto-promotion: %sabled)\n",
1172 msr, msr & 0x2 ? "EN" : "DIS"); 1172 base_cpu, msr, msr & 0x2 ? "EN" : "DIS");
1173 1173
1174 return; 1174 return;
1175} 1175}
@@ -1182,7 +1182,7 @@ dump_hsw_turbo_ratio_limits(void)
1182 1182
1183 get_msr(base_cpu, MSR_TURBO_RATIO_LIMIT2, &msr); 1183 get_msr(base_cpu, MSR_TURBO_RATIO_LIMIT2, &msr);
1184 1184
1185 fprintf(stderr, "cpu0: MSR_TURBO_RATIO_LIMIT2: 0x%08llx\n", msr); 1185 fprintf(stderr, "cpu%d: MSR_TURBO_RATIO_LIMIT2: 0x%08llx\n", base_cpu, msr);
1186 1186
1187 ratio = (msr >> 8) & 0xFF; 1187 ratio = (msr >> 8) & 0xFF;
1188 if (ratio) 1188 if (ratio)
@@ -1204,7 +1204,7 @@ dump_ivt_turbo_ratio_limits(void)
1204 1204
1205 get_msr(base_cpu, MSR_TURBO_RATIO_LIMIT1, &msr); 1205 get_msr(base_cpu, MSR_TURBO_RATIO_LIMIT1, &msr);
1206 1206
1207 fprintf(stderr, "cpu0: MSR_TURBO_RATIO_LIMIT1: 0x%08llx\n", msr); 1207 fprintf(stderr, "cpu%d: MSR_TURBO_RATIO_LIMIT1: 0x%08llx\n", base_cpu, msr);
1208 1208
1209 ratio = (msr >> 56) & 0xFF; 1209 ratio = (msr >> 56) & 0xFF;
1210 if (ratio) 1210 if (ratio)
@@ -1256,7 +1256,7 @@ dump_nhm_turbo_ratio_limits(void)
1256 1256
1257 get_msr(base_cpu, MSR_TURBO_RATIO_LIMIT, &msr); 1257 get_msr(base_cpu, MSR_TURBO_RATIO_LIMIT, &msr);
1258 1258
1259 fprintf(stderr, "cpu0: MSR_TURBO_RATIO_LIMIT: 0x%08llx\n", msr); 1259 fprintf(stderr, "cpu%d: MSR_TURBO_RATIO_LIMIT: 0x%08llx\n", base_cpu, msr);
1260 1260
1261 ratio = (msr >> 56) & 0xFF; 1261 ratio = (msr >> 56) & 0xFF;
1262 if (ratio) 1262 if (ratio)
@@ -1312,8 +1312,8 @@ dump_knl_turbo_ratio_limits(void)
1312 1312
1313 get_msr(base_cpu, MSR_NHM_TURBO_RATIO_LIMIT, &msr); 1313 get_msr(base_cpu, MSR_NHM_TURBO_RATIO_LIMIT, &msr);
1314 1314
1315 fprintf(stderr, "cpu0: MSR_NHM_TURBO_RATIO_LIMIT: 0x%08llx\n", 1315 fprintf(stderr, "cpu%d: MSR_NHM_TURBO_RATIO_LIMIT: 0x%08llx\n",
1316 msr); 1316 base_cpu, msr);
1317 1317
1318 /** 1318 /**
1319 * Turbo encoding in KNL is as follows: 1319 * Turbo encoding in KNL is as follows:
@@ -1371,7 +1371,7 @@ dump_nhm_cst_cfg(void)
1371#define SNB_C1_AUTO_UNDEMOTE (1UL << 27) 1371#define SNB_C1_AUTO_UNDEMOTE (1UL << 27)
1372#define SNB_C3_AUTO_UNDEMOTE (1UL << 28) 1372#define SNB_C3_AUTO_UNDEMOTE (1UL << 28)
1373 1373
1374 fprintf(stderr, "cpu0: MSR_NHM_SNB_PKG_CST_CFG_CTL: 0x%08llx", msr); 1374 fprintf(stderr, "cpu%d: MSR_NHM_SNB_PKG_CST_CFG_CTL: 0x%08llx", base_cpu, msr);
1375 1375
1376 fprintf(stderr, " (%s%s%s%s%slocked: pkg-cstate-limit=%d: %s)\n", 1376 fprintf(stderr, " (%s%s%s%s%slocked: pkg-cstate-limit=%d: %s)\n",
1377 (msr & SNB_C3_AUTO_UNDEMOTE) ? "UNdemote-C3, " : "", 1377 (msr & SNB_C3_AUTO_UNDEMOTE) ? "UNdemote-C3, " : "",
@@ -1384,6 +1384,49 @@ dump_nhm_cst_cfg(void)
1384 return; 1384 return;
1385} 1385}
1386 1386
1387static void
1388dump_config_tdp(void)
1389{
1390 unsigned long long msr;
1391
1392 get_msr(base_cpu, MSR_CONFIG_TDP_NOMINAL, &msr);
1393 fprintf(stderr, "cpu%d: MSR_CONFIG_TDP_NOMINAL: 0x%08llx", base_cpu, msr);
1394 fprintf(stderr, " (base_ratio=%d)\n", (unsigned int)msr & 0xEF);
1395
1396 get_msr(base_cpu, MSR_CONFIG_TDP_LEVEL_1, &msr);
1397 fprintf(stderr, "cpu%d: MSR_CONFIG_TDP_LEVEL_1: 0x%08llx (", base_cpu, msr);
1398 if (msr) {
1399 fprintf(stderr, "PKG_MIN_PWR_LVL1=%d ", (unsigned int)(msr >> 48) & 0xEFFF);
1400 fprintf(stderr, "PKG_MAX_PWR_LVL1=%d ", (unsigned int)(msr >> 32) & 0xEFFF);
1401 fprintf(stderr, "LVL1_RATIO=%d ", (unsigned int)(msr >> 16) & 0xEF);
1402 fprintf(stderr, "PKG_TDP_LVL1=%d", (unsigned int)(msr) & 0xEFFF);
1403 }
1404 fprintf(stderr, ")\n");
1405
1406 get_msr(base_cpu, MSR_CONFIG_TDP_LEVEL_2, &msr);
1407 fprintf(stderr, "cpu%d: MSR_CONFIG_TDP_LEVEL_2: 0x%08llx (", base_cpu, msr);
1408 if (msr) {
1409 fprintf(stderr, "PKG_MIN_PWR_LVL2=%d ", (unsigned int)(msr >> 48) & 0xEFFF);
1410 fprintf(stderr, "PKG_MAX_PWR_LVL2=%d ", (unsigned int)(msr >> 32) & 0xEFFF);
1411 fprintf(stderr, "LVL2_RATIO=%d ", (unsigned int)(msr >> 16) & 0xEF);
1412 fprintf(stderr, "PKG_TDP_LVL2=%d", (unsigned int)(msr) & 0xEFFF);
1413 }
1414 fprintf(stderr, ")\n");
1415
1416 get_msr(base_cpu, MSR_CONFIG_TDP_CONTROL, &msr);
1417 fprintf(stderr, "cpu%d: MSR_CONFIG_TDP_CONTROL: 0x%08llx (", base_cpu, msr);
1418 if ((msr) & 0x3)
1419 fprintf(stderr, "TDP_LEVEL=%d ", (unsigned int)(msr) & 0x3);
1420 fprintf(stderr, " lock=%d", (unsigned int)(msr >> 31) & 1);
1421 fprintf(stderr, ")\n");
1422
1423 get_msr(base_cpu, MSR_TURBO_ACTIVATION_RATIO, &msr);
1424 fprintf(stderr, "cpu%d: MSR_TURBO_ACTIVATION_RATIO: 0x%08llx (", base_cpu, msr);
1425 fprintf(stderr, "MAX_NON_TURBO_RATIO=%d", (unsigned int)(msr) & 0xEF);
1426 fprintf(stderr, " lock=%d", (unsigned int)(msr >> 31) & 1);
1427 fprintf(stderr, ")\n");
1428}
1429
1387void free_all_buffers(void) 1430void free_all_buffers(void)
1388{ 1431{
1389 CPU_FREE(cpu_present_set); 1432 CPU_FREE(cpu_present_set);
@@ -1873,6 +1916,36 @@ int has_knl_turbo_ratio_limit(unsigned int family, unsigned int model)
1873 return 0; 1916 return 0;
1874 } 1917 }
1875} 1918}
1919int has_config_tdp(unsigned int family, unsigned int model)
1920{
1921 if (!genuine_intel)
1922 return 0;
1923
1924 if (family != 6)
1925 return 0;
1926
1927 switch (model) {
1928 case 0x3A: /* IVB */
1929 case 0x3E: /* IVB Xeon */
1930
1931 case 0x3C: /* HSW */
1932 case 0x3F: /* HSX */
1933 case 0x45: /* HSW */
1934 case 0x46: /* HSW */
1935 case 0x3D: /* BDW */
1936 case 0x47: /* BDW */
1937 case 0x4F: /* BDX */
1938 case 0x56: /* BDX-DE */
1939 case 0x4E: /* SKL */
1940 case 0x5E: /* SKL */
1941
1942 case 0x57: /* Knights Landing */
1943 return 1;
1944 default:
1945 return 0;
1946 }
1947}
1948
1876static void 1949static void
1877dump_cstate_pstate_config_info(family, model) 1950dump_cstate_pstate_config_info(family, model)
1878{ 1951{
@@ -1893,6 +1966,9 @@ dump_cstate_pstate_config_info(family, model)
1893 if (has_knl_turbo_ratio_limit(family, model)) 1966 if (has_knl_turbo_ratio_limit(family, model))
1894 dump_knl_turbo_ratio_limits(); 1967 dump_knl_turbo_ratio_limits();
1895 1968
1969 if (has_config_tdp(family, model))
1970 dump_config_tdp();
1971
1896 dump_nhm_cst_cfg(); 1972 dump_nhm_cst_cfg();
1897} 1973}
1898 1974
@@ -3014,7 +3090,7 @@ int get_and_dump_counters(void)
3014} 3090}
3015 3091
3016void print_version() { 3092void print_version() {
3017 fprintf(stderr, "turbostat version 4.7 27-May, 2015" 3093 fprintf(stderr, "turbostat version 4.7 17-June, 2015"
3018 " - Len Brown <lenb@kernel.org>\n"); 3094 " - Len Brown <lenb@kernel.org>\n");
3019} 3095}
3020 3096
@@ -3042,7 +3118,7 @@ void cmdline(int argc, char **argv)
3042 3118
3043 progname = argv[0]; 3119 progname = argv[0];
3044 3120
3045 while ((opt = getopt_long_only(argc, argv, "C:c:Ddhi:JM:m:PpST:v", 3121 while ((opt = getopt_long_only(argc, argv, "+C:c:Ddhi:JM:m:PpST:v",
3046 long_options, &option_index)) != -1) { 3122 long_options, &option_index)) != -1) {
3047 switch (opt) { 3123 switch (opt) {
3048 case 'C': 3124 case 'C':