Commit 73786683 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux

Pull thermal fixes from Zhang Rui:
 "Specifics:

   - fix an issue in intel_powerclamp driver that idle injection target
     is not accurately maintained on newer Intel CPUs.  Package C8 to
     C10 states are introduced on these CPUs but they were not included
     in the package c-state residency calculation.  From Jacob Pan.

   - fix a problem that package c-state idle injection was missing on
     Broadwell server, by adding its id to intel_powerclamp driver.
     From Jacob Pan.

   - a couple of small fixes and cleanups from Joe Perches, Mathias
     Krause, Dan Carpenter and Anand Moon"

* 'for-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux:
  tools/thermal: tmon: fixed the 'make install' command
  thermal: rockchip: fix an error code
  thermal/powerclamp: fix missing newer package c-states
  thermal/intel_powerclamp: add id for broadwell server
  thermal/intel_powerclamp: add __init / __exit annotations
  thermal: Use bool function return values of true/false not 1/0
parents d70933be b100e77f
...@@ -206,51 +206,57 @@ static void find_target_mwait(void) ...@@ -206,51 +206,57 @@ static void find_target_mwait(void)
} }
struct pkg_cstate_info {
bool skip;
int msr_index;
int cstate_id;
};
#define PKG_CSTATE_INIT(id) { \
.msr_index = MSR_PKG_C##id##_RESIDENCY, \
.cstate_id = id \
}
static struct pkg_cstate_info pkg_cstates[] = {
PKG_CSTATE_INIT(2),
PKG_CSTATE_INIT(3),
PKG_CSTATE_INIT(6),
PKG_CSTATE_INIT(7),
PKG_CSTATE_INIT(8),
PKG_CSTATE_INIT(9),
PKG_CSTATE_INIT(10),
{NULL},
};
static bool has_pkg_state_counter(void) static bool has_pkg_state_counter(void)
{ {
u64 tmp; u64 val;
return !rdmsrl_safe(MSR_PKG_C2_RESIDENCY, &tmp) || struct pkg_cstate_info *info = pkg_cstates;
!rdmsrl_safe(MSR_PKG_C3_RESIDENCY, &tmp) ||
!rdmsrl_safe(MSR_PKG_C6_RESIDENCY, &tmp) || /* check if any one of the counter msrs exists */
!rdmsrl_safe(MSR_PKG_C7_RESIDENCY, &tmp); while (info->msr_index) {
if (!rdmsrl_safe(info->msr_index, &val))
return true;
info++;
}
return false;
} }
static u64 pkg_state_counter(void) static u64 pkg_state_counter(void)
{ {
u64 val; u64 val;
u64 count = 0; u64 count = 0;
struct pkg_cstate_info *info = pkg_cstates;
static bool skip_c2;
static bool skip_c3; while (info->msr_index) {
static bool skip_c6; if (!info->skip) {
static bool skip_c7; if (!rdmsrl_safe(info->msr_index, &val))
count += val;
if (!skip_c2) { else
if (!rdmsrl_safe(MSR_PKG_C2_RESIDENCY, &val)) info->skip = true;
count += val; }
else info++;
skip_c2 = true;
}
if (!skip_c3) {
if (!rdmsrl_safe(MSR_PKG_C3_RESIDENCY, &val))
count += val;
else
skip_c3 = true;
}
if (!skip_c6) {
if (!rdmsrl_safe(MSR_PKG_C6_RESIDENCY, &val))
count += val;
else
skip_c6 = true;
}
if (!skip_c7) {
if (!rdmsrl_safe(MSR_PKG_C7_RESIDENCY, &val))
count += val;
else
skip_c7 = true;
} }
return count; return count;
...@@ -667,7 +673,7 @@ static struct thermal_cooling_device_ops powerclamp_cooling_ops = { ...@@ -667,7 +673,7 @@ static struct thermal_cooling_device_ops powerclamp_cooling_ops = {
}; };
/* runs on Nehalem and later */ /* runs on Nehalem and later */
static const struct x86_cpu_id intel_powerclamp_ids[] = { static const struct x86_cpu_id intel_powerclamp_ids[] __initconst = {
{ X86_VENDOR_INTEL, 6, 0x1a}, { X86_VENDOR_INTEL, 6, 0x1a},
{ X86_VENDOR_INTEL, 6, 0x1c}, { X86_VENDOR_INTEL, 6, 0x1c},
{ X86_VENDOR_INTEL, 6, 0x1e}, { X86_VENDOR_INTEL, 6, 0x1e},
...@@ -689,12 +695,13 @@ static const struct x86_cpu_id intel_powerclamp_ids[] = { ...@@ -689,12 +695,13 @@ static const struct x86_cpu_id intel_powerclamp_ids[] = {
{ X86_VENDOR_INTEL, 6, 0x46}, { X86_VENDOR_INTEL, 6, 0x46},
{ X86_VENDOR_INTEL, 6, 0x4c}, { X86_VENDOR_INTEL, 6, 0x4c},
{ X86_VENDOR_INTEL, 6, 0x4d}, { X86_VENDOR_INTEL, 6, 0x4d},
{ X86_VENDOR_INTEL, 6, 0x4f},
{ X86_VENDOR_INTEL, 6, 0x56}, { X86_VENDOR_INTEL, 6, 0x56},
{} {}
}; };
MODULE_DEVICE_TABLE(x86cpu, intel_powerclamp_ids); MODULE_DEVICE_TABLE(x86cpu, intel_powerclamp_ids);
static int powerclamp_probe(void) static int __init powerclamp_probe(void)
{ {
if (!x86_match_cpu(intel_powerclamp_ids)) { if (!x86_match_cpu(intel_powerclamp_ids)) {
pr_err("Intel powerclamp does not run on family %d model %d\n", pr_err("Intel powerclamp does not run on family %d model %d\n",
...@@ -760,7 +767,7 @@ static inline void powerclamp_create_debug_files(void) ...@@ -760,7 +767,7 @@ static inline void powerclamp_create_debug_files(void)
debugfs_remove_recursive(debug_dir); debugfs_remove_recursive(debug_dir);
} }
static int powerclamp_init(void) static int __init powerclamp_init(void)
{ {
int retval; int retval;
int bitmap_size; int bitmap_size;
...@@ -809,7 +816,7 @@ static int powerclamp_init(void) ...@@ -809,7 +816,7 @@ static int powerclamp_init(void)
} }
module_init(powerclamp_init); module_init(powerclamp_init);
static void powerclamp_exit(void) static void __exit powerclamp_exit(void)
{ {
unregister_hotcpu_notifier(&powerclamp_cpu_notifier); unregister_hotcpu_notifier(&powerclamp_cpu_notifier);
end_power_clamp(); end_power_clamp();
......
...@@ -529,7 +529,7 @@ static int rockchip_thermal_probe(struct platform_device *pdev) ...@@ -529,7 +529,7 @@ static int rockchip_thermal_probe(struct platform_device *pdev)
thermal->pclk = devm_clk_get(&pdev->dev, "apb_pclk"); thermal->pclk = devm_clk_get(&pdev->dev, "apb_pclk");
if (IS_ERR(thermal->pclk)) { if (IS_ERR(thermal->pclk)) {
error = PTR_ERR(thermal->clk); error = PTR_ERR(thermal->pclk);
dev_err(&pdev->dev, "failed to get apb_pclk clock: %d\n", dev_err(&pdev->dev, "failed to get apb_pclk clock: %d\n",
error); error);
return error; return error;
......
...@@ -103,7 +103,7 @@ static inline int of_thermal_get_ntrips(struct thermal_zone_device *tz) ...@@ -103,7 +103,7 @@ static inline int of_thermal_get_ntrips(struct thermal_zone_device *tz)
static inline bool of_thermal_is_trip_valid(struct thermal_zone_device *tz, static inline bool of_thermal_is_trip_valid(struct thermal_zone_device *tz,
int trip) int trip)
{ {
return 0; return false;
} }
static inline const struct thermal_trip * static inline const struct thermal_trip *
of_thermal_get_trip_points(struct thermal_zone_device *tz) of_thermal_get_trip_points(struct thermal_zone_device *tz)
......
...@@ -12,10 +12,6 @@ TARGET=tmon ...@@ -12,10 +12,6 @@ TARGET=tmon
INSTALL_PROGRAM=install -m 755 -p INSTALL_PROGRAM=install -m 755 -p
DEL_FILE=rm -f DEL_FILE=rm -f
INSTALL_CONFIGFILE=install -m 644 -p
CONFIG_FILE=
CONFIG_PATH=
# Static builds might require -ltinfo, for instance # Static builds might require -ltinfo, for instance
ifneq ($(findstring -static, $(LDFLAGS)),) ifneq ($(findstring -static, $(LDFLAGS)),)
STATIC := --static STATIC := --static
...@@ -38,13 +34,9 @@ valgrind: tmon ...@@ -38,13 +34,9 @@ valgrind: tmon
install: install:
- mkdir -p $(INSTALL_ROOT)/$(BINDIR) - mkdir -p $(INSTALL_ROOT)/$(BINDIR)
- $(INSTALL_PROGRAM) "$(TARGET)" "$(INSTALL_ROOT)/$(BINDIR)/$(TARGET)" - $(INSTALL_PROGRAM) "$(TARGET)" "$(INSTALL_ROOT)/$(BINDIR)/$(TARGET)"
- mkdir -p $(INSTALL_ROOT)/$(CONFIG_PATH)
- $(INSTALL_CONFIGFILE) "$(CONFIG_FILE)" "$(INSTALL_ROOT)/$(CONFIG_PATH)"
uninstall: uninstall:
$(DEL_FILE) "$(INSTALL_ROOT)/$(BINDIR)/$(TARGET)" $(DEL_FILE) "$(INSTALL_ROOT)/$(BINDIR)/$(TARGET)"
$(CONFIG_FILE) "$(CONFIG_PATH)"
clean: clean:
find . -name "*.o" | xargs $(DEL_FILE) find . -name "*.o" | xargs $(DEL_FILE)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment