aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-10-01 22:06:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-10-01 22:06:40 -0400
commit1bca1000fa71a1092947b4a51928abe80a3316d2 (patch)
treed229750e2baeeba923722697fd0c40d4288442fc
parent3deaa4f531506a12ac4860ccd83cb6cbcb15a7eb (diff)
parenteb6d1c287ae1f7221248d5be26a5b1560073c09e (diff)
Merge tag 'pm+acpi-4.3-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management and ACPI fixes from Rafael Wysocki: "These are fixes mostly, for a few changes made in this cycle (the intel_idle driver, the OPP library, the ACPI EC driver, turbostat) and for some issues that have just been discovered (ACPI PCI IRQ management, PCI power management documentation, turbostat), with a couple of cleanups on top of them. Specifics: - intel_idle driver fixup for the recently added Skylake chips support (Len Brown). - Operating Performance Points (OPP) library fix related to the recently added support for new DT bindings and a fix for a typo in a comment (Viresh Kumar, Stephen Boyd). - ACPI EC driver fix for a recently introduced memory leak in an error code path (Lv Zheng). - ACPI PCI IRQ management fix for the issue where an ISA IRQ is shared with a PCI device which requires it to be configured in a different way and may cause an interrupt storm to happen as a result with an extra ACPI SCI IRQ handling simplification on top of it (Jiang Liu). - Update of the PCI power management documentation that became outdated and started to actively confuse the readers to make it actually reflect the code (Rafael J Wysocki). - turbostat fixes including an IVB Xeon regression fix (related to the --debug command line option), Skylake adjustment for the TSC running at a frequency that doesn't match the base one exactly, and a Knights Landing quirk to account for the fact that it only updates APERF and MPERF every 1024 clock cycles plus bumping up the turbostat version number (Len Brown, Hubert Chrzaniuk)" * tag 'pm+acpi-4.3-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: tools/power turbosat: update version number tools/power turbostat: SKL: Adjust for TSC difference from base frequency tools/power turbostat: KNL workaround for %Busy and Avg_MHz tools/power turbostat: IVB Xeon: fix --debug regression ACPI / PCI: Remove duplicated penalty on SCI IRQ ACPI, PCI, irq: Do not share PCI IRQ with ISA IRQ ACPI / EC: Fix a memory leak issue in acpi_ec_query() PM / OPP: Fix typo modifcation -> modification PCI / PM: Update runtime PM documentation for PCI devices PM / OPP: of_property_count_u32_elems() can return errors intel_idle: Skylake Client Support - updated
-rw-r--r--Documentation/power/pci.txt51
-rw-r--r--drivers/acpi/ec.c2
-rw-r--r--drivers/acpi/pci_irq.c1
-rw-r--r--drivers/acpi/pci_link.c16
-rw-r--r--drivers/base/power/opp.c17
-rw-r--r--drivers/idle/intel_idle.c12
-rw-r--r--drivers/pci/pci-driver.c7
-rw-r--r--include/linux/acpi.h1
-rw-r--r--tools/power/x86/turbostat/turbostat.c39
9 files changed, 116 insertions, 30 deletions
diff --git a/Documentation/power/pci.txt b/Documentation/power/pci.txt
index 62328d76b55b..b0e911e0e8f5 100644
--- a/Documentation/power/pci.txt
+++ b/Documentation/power/pci.txt
@@ -979,20 +979,45 @@ every time right after the runtime_resume() callback has returned
979(alternatively, the runtime_suspend() callback will have to check if the 979(alternatively, the runtime_suspend() callback will have to check if the
980device should really be suspended and return -EAGAIN if that is not the case). 980device should really be suspended and return -EAGAIN if that is not the case).
981 981
982The runtime PM of PCI devices is disabled by default. It is also blocked by 982The runtime PM of PCI devices is enabled by default by the PCI core. PCI
983pci_pm_init() that runs the pm_runtime_forbid() helper function. If a PCI 983device drivers do not need to enable it and should not attempt to do so.
984driver implements the runtime PM callbacks and intends to use the runtime PM 984However, it is blocked by pci_pm_init() that runs the pm_runtime_forbid()
985framework provided by the PM core and the PCI subsystem, it should enable this 985helper function. In addition to that, the runtime PM usage counter of
986feature by executing the pm_runtime_enable() helper function. However, the 986each PCI device is incremented by local_pci_probe() before executing the
987driver should not call the pm_runtime_allow() helper function unblocking 987probe callback provided by the device's driver.
988the runtime PM of the device. Instead, it should allow user space or some 988
989platform-specific code to do that (user space can do it via sysfs), although 989If a PCI driver implements the runtime PM callbacks and intends to use the
990once it has called pm_runtime_enable(), it must be prepared to handle the 990runtime PM framework provided by the PM core and the PCI subsystem, it needs
991to decrement the device's runtime PM usage counter in its probe callback
992function. If it doesn't do that, the counter will always be different from
993zero for the device and it will never be runtime-suspended. The simplest
994way to do that is by calling pm_runtime_put_noidle(), but if the driver
995wants to schedule an autosuspend right away, for example, it may call
996pm_runtime_put_autosuspend() instead for this purpose. Generally, it
997just needs to call a function that decrements the devices usage counter
998from its probe routine to make runtime PM work for the device.
999
1000It is important to remember that the driver's runtime_suspend() callback
1001may be executed right after the usage counter has been decremented, because
1002user space may already have cuased the pm_runtime_allow() helper function
1003unblocking the runtime PM of the device to run via sysfs, so the driver must
1004be prepared to cope with that.
1005
1006The driver itself should not call pm_runtime_allow(), though. Instead, it
1007should let user space or some platform-specific code do that (user space can
1008do it via sysfs as stated above), but it must be prepared to handle the
991runtime PM of the device correctly as soon as pm_runtime_allow() is called 1009runtime PM of the device correctly as soon as pm_runtime_allow() is called
992(which may happen at any time). [It also is possible that user space causes 1010(which may happen at any time, even before the driver is loaded).
993pm_runtime_allow() to be called via sysfs before the driver is loaded, so in 1011
994fact the driver has to be prepared to handle the runtime PM of the device as 1012When the driver's remove callback runs, it has to balance the decrementation
995soon as it calls pm_runtime_enable().] 1013of the device's runtime PM usage counter at the probe time. For this reason,
1014if it has decremented the counter in its probe callback, it must run
1015pm_runtime_get_noresume() in its remove callback. [Since the core carries
1016out a runtime resume of the device and bumps up the device's usage counter
1017before running the driver's remove callback, the runtime PM of the device
1018is effectively disabled for the duration of the remove execution and all
1019runtime PM helper functions incrementing the device's usage counter are
1020then effectively equivalent to pm_runtime_get_noresume().]
996 1021
997The runtime PM framework works by processing requests to suspend or resume 1022The runtime PM framework works by processing requests to suspend or resume
998devices, or to check if they are idle (in which cases it is reasonable to 1023devices, or to check if they are idle (in which cases it is reasonable to
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 2614a839c60d..42c66b64c12c 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -1044,8 +1044,10 @@ static int acpi_ec_query(struct acpi_ec *ec, u8 *data)
1044 goto err_exit; 1044 goto err_exit;
1045 1045
1046 mutex_lock(&ec->mutex); 1046 mutex_lock(&ec->mutex);
1047 result = -ENODATA;
1047 list_for_each_entry(handler, &ec->list, node) { 1048 list_for_each_entry(handler, &ec->list, node) {
1048 if (value == handler->query_bit) { 1049 if (value == handler->query_bit) {
1050 result = 0;
1049 q->handler = acpi_ec_get_query_handler(handler); 1051 q->handler = acpi_ec_get_query_handler(handler);
1050 ec_dbg_evt("Query(0x%02x) scheduled", 1052 ec_dbg_evt("Query(0x%02x) scheduled",
1051 q->handler->query_bit); 1053 q->handler->query_bit);
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
index 6da0f9beab19..c9336751e5e3 100644
--- a/drivers/acpi/pci_irq.c
+++ b/drivers/acpi/pci_irq.c
@@ -372,6 +372,7 @@ static int acpi_isa_register_gsi(struct pci_dev *dev)
372 372
373 /* Interrupt Line values above 0xF are forbidden */ 373 /* Interrupt Line values above 0xF are forbidden */
374 if (dev->irq > 0 && (dev->irq <= 0xF) && 374 if (dev->irq > 0 && (dev->irq <= 0xF) &&
375 acpi_isa_irq_available(dev->irq) &&
375 (acpi_isa_irq_to_gsi(dev->irq, &dev_gsi) == 0)) { 376 (acpi_isa_irq_to_gsi(dev->irq, &dev_gsi) == 0)) {
376 dev_warn(&dev->dev, "PCI INT %c: no GSI - using ISA IRQ %d\n", 377 dev_warn(&dev->dev, "PCI INT %c: no GSI - using ISA IRQ %d\n",
377 pin_name(dev->pin), dev->irq); 378 pin_name(dev->pin), dev->irq);
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
index 3b4ea98e3ea0..7c8408b946ca 100644
--- a/drivers/acpi/pci_link.c
+++ b/drivers/acpi/pci_link.c
@@ -498,8 +498,7 @@ int __init acpi_irq_penalty_init(void)
498 PIRQ_PENALTY_PCI_POSSIBLE; 498 PIRQ_PENALTY_PCI_POSSIBLE;
499 } 499 }
500 } 500 }
501 /* Add a penalty for the SCI */ 501
502 acpi_irq_penalty[acpi_gbl_FADT.sci_interrupt] += PIRQ_PENALTY_PCI_USING;
503 return 0; 502 return 0;
504} 503}
505 504
@@ -553,6 +552,13 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)
553 irq = link->irq.possible[i]; 552 irq = link->irq.possible[i];
554 } 553 }
555 } 554 }
555 if (acpi_irq_penalty[irq] >= PIRQ_PENALTY_ISA_ALWAYS) {
556 printk(KERN_ERR PREFIX "No IRQ available for %s [%s]. "
557 "Try pci=noacpi or acpi=off\n",
558 acpi_device_name(link->device),
559 acpi_device_bid(link->device));
560 return -ENODEV;
561 }
556 562
557 /* Attempt to enable the link device at this IRQ. */ 563 /* Attempt to enable the link device at this IRQ. */
558 if (acpi_pci_link_set(link, irq)) { 564 if (acpi_pci_link_set(link, irq)) {
@@ -821,6 +827,12 @@ void acpi_penalize_isa_irq(int irq, int active)
821 } 827 }
822} 828}
823 829
830bool acpi_isa_irq_available(int irq)
831{
832 return irq >= 0 && (irq >= ARRAY_SIZE(acpi_irq_penalty) ||
833 acpi_irq_penalty[irq] < PIRQ_PENALTY_ISA_ALWAYS);
834}
835
824/* 836/*
825 * Penalize IRQ used by ACPI SCI. If ACPI SCI pin attributes conflict with 837 * Penalize IRQ used by ACPI SCI. If ACPI SCI pin attributes conflict with
826 * PCI IRQ attributes, mark ACPI SCI as ISA_ALWAYS so it won't be use for 838 * PCI IRQ attributes, mark ACPI SCI as ISA_ALWAYS so it won't be use for
diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
index 28cd75c535b0..7ae7cd990fbf 100644
--- a/drivers/base/power/opp.c
+++ b/drivers/base/power/opp.c
@@ -892,10 +892,17 @@ static int opp_get_microvolt(struct dev_pm_opp *opp, struct device *dev)
892 u32 microvolt[3] = {0}; 892 u32 microvolt[3] = {0};
893 int count, ret; 893 int count, ret;
894 894
895 count = of_property_count_u32_elems(opp->np, "opp-microvolt"); 895 /* Missing property isn't a problem, but an invalid entry is */
896 if (!count) 896 if (!of_find_property(opp->np, "opp-microvolt", NULL))
897 return 0; 897 return 0;
898 898
899 count = of_property_count_u32_elems(opp->np, "opp-microvolt");
900 if (count < 0) {
901 dev_err(dev, "%s: Invalid opp-microvolt property (%d)\n",
902 __func__, count);
903 return count;
904 }
905
899 /* There can be one or three elements here */ 906 /* There can be one or three elements here */
900 if (count != 1 && count != 3) { 907 if (count != 1 && count != 3) {
901 dev_err(dev, "%s: Invalid number of elements in opp-microvolt property (%d)\n", 908 dev_err(dev, "%s: Invalid number of elements in opp-microvolt property (%d)\n",
@@ -1063,7 +1070,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_add);
1063 * share a common logic which is isolated here. 1070 * share a common logic which is isolated here.
1064 * 1071 *
1065 * Return: -EINVAL for bad pointers, -ENOMEM if no memory available for the 1072 * Return: -EINVAL for bad pointers, -ENOMEM if no memory available for the
1066 * copy operation, returns 0 if no modifcation was done OR modification was 1073 * copy operation, returns 0 if no modification was done OR modification was
1067 * successful. 1074 * successful.
1068 * 1075 *
1069 * Locking: The internal device_opp and opp structures are RCU protected. 1076 * Locking: The internal device_opp and opp structures are RCU protected.
@@ -1151,7 +1158,7 @@ unlock:
1151 * mutex locking or synchronize_rcu() blocking calls cannot be used. 1158 * mutex locking or synchronize_rcu() blocking calls cannot be used.
1152 * 1159 *
1153 * Return: -EINVAL for bad pointers, -ENOMEM if no memory available for the 1160 * Return: -EINVAL for bad pointers, -ENOMEM if no memory available for the
1154 * copy operation, returns 0 if no modifcation was done OR modification was 1161 * copy operation, returns 0 if no modification was done OR modification was
1155 * successful. 1162 * successful.
1156 */ 1163 */
1157int dev_pm_opp_enable(struct device *dev, unsigned long freq) 1164int dev_pm_opp_enable(struct device *dev, unsigned long freq)
@@ -1177,7 +1184,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_enable);
1177 * mutex locking or synchronize_rcu() blocking calls cannot be used. 1184 * mutex locking or synchronize_rcu() blocking calls cannot be used.
1178 * 1185 *
1179 * Return: -EINVAL for bad pointers, -ENOMEM if no memory available for the 1186 * Return: -EINVAL for bad pointers, -ENOMEM if no memory available for the
1180 * copy operation, returns 0 if no modifcation was done OR modification was 1187 * copy operation, returns 0 if no modification was done OR modification was
1181 * successful. 1188 * successful.
1182 */ 1189 */
1183int dev_pm_opp_disable(struct device *dev, unsigned long freq) 1190int dev_pm_opp_disable(struct device *dev, unsigned long freq)
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index 3a3738fe016b..cd4510a63375 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -620,7 +620,7 @@ static struct cpuidle_state skl_cstates[] = {
620 .name = "C6-SKL", 620 .name = "C6-SKL",
621 .desc = "MWAIT 0x20", 621 .desc = "MWAIT 0x20",
622 .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED, 622 .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
623 .exit_latency = 75, 623 .exit_latency = 85,
624 .target_residency = 200, 624 .target_residency = 200,
625 .enter = &intel_idle, 625 .enter = &intel_idle,
626 .enter_freeze = intel_idle_freeze, }, 626 .enter_freeze = intel_idle_freeze, },
@@ -636,11 +636,19 @@ static struct cpuidle_state skl_cstates[] = {
636 .name = "C8-SKL", 636 .name = "C8-SKL",
637 .desc = "MWAIT 0x40", 637 .desc = "MWAIT 0x40",
638 .flags = MWAIT2flg(0x40) | CPUIDLE_FLAG_TLB_FLUSHED, 638 .flags = MWAIT2flg(0x40) | CPUIDLE_FLAG_TLB_FLUSHED,
639 .exit_latency = 174, 639 .exit_latency = 200,
640 .target_residency = 800, 640 .target_residency = 800,
641 .enter = &intel_idle, 641 .enter = &intel_idle,
642 .enter_freeze = intel_idle_freeze, }, 642 .enter_freeze = intel_idle_freeze, },
643 { 643 {
644 .name = "C9-SKL",
645 .desc = "MWAIT 0x50",
646 .flags = MWAIT2flg(0x50) | CPUIDLE_FLAG_TLB_FLUSHED,
647 .exit_latency = 480,
648 .target_residency = 5000,
649 .enter = &intel_idle,
650 .enter_freeze = intel_idle_freeze, },
651 {
644 .name = "C10-SKL", 652 .name = "C10-SKL",
645 .desc = "MWAIT 0x60", 653 .desc = "MWAIT 0x60",
646 .flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED, 654 .flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED,
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index dd652f2ae03d..108a3118ace7 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -299,9 +299,10 @@ static long local_pci_probe(void *_ddi)
299 * Unbound PCI devices are always put in D0, regardless of 299 * Unbound PCI devices are always put in D0, regardless of
300 * runtime PM status. During probe, the device is set to 300 * runtime PM status. During probe, the device is set to
301 * active and the usage count is incremented. If the driver 301 * active and the usage count is incremented. If the driver
302 * supports runtime PM, it should call pm_runtime_put_noidle() 302 * supports runtime PM, it should call pm_runtime_put_noidle(),
303 * in its probe routine and pm_runtime_get_noresume() in its 303 * or any other runtime PM helper function decrementing the usage
304 * remove routine. 304 * count, in its probe routine and pm_runtime_get_noresume() in
305 * its remove routine.
305 */ 306 */
306 pm_runtime_get_sync(dev); 307 pm_runtime_get_sync(dev);
307 pci_dev->driver = pci_drv; 308 pci_dev->driver = pci_drv;
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 7235c4851460..43856d19cf4d 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -217,6 +217,7 @@ struct pci_dev;
217 217
218int acpi_pci_irq_enable (struct pci_dev *dev); 218int acpi_pci_irq_enable (struct pci_dev *dev);
219void acpi_penalize_isa_irq(int irq, int active); 219void acpi_penalize_isa_irq(int irq, int active);
220bool acpi_isa_irq_available(int irq);
220void acpi_penalize_sci_irq(int irq, int trigger, int polarity); 221void acpi_penalize_sci_irq(int irq, int trigger, int polarity);
221void acpi_pci_irq_disable (struct pci_dev *dev); 222void acpi_pci_irq_disable (struct pci_dev *dev);
222 223
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 9655cb49c7cb..bde0ef1a63df 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -71,8 +71,11 @@ unsigned int extra_msr_offset32;
71unsigned int extra_msr_offset64; 71unsigned int extra_msr_offset64;
72unsigned int extra_delta_offset32; 72unsigned int extra_delta_offset32;
73unsigned int extra_delta_offset64; 73unsigned int extra_delta_offset64;
74unsigned int aperf_mperf_multiplier = 1;
74int do_smi; 75int do_smi;
75double bclk; 76double bclk;
77double base_hz;
78double tsc_tweak = 1.0;
76unsigned int show_pkg; 79unsigned int show_pkg;
77unsigned int show_core; 80unsigned int show_core;
78unsigned int show_cpu; 81unsigned int show_cpu;
@@ -502,7 +505,7 @@ int format_counters(struct thread_data *t, struct core_data *c,
502 /* %Busy */ 505 /* %Busy */
503 if (has_aperf) { 506 if (has_aperf) {
504 if (!skip_c0) 507 if (!skip_c0)
505 outp += sprintf(outp, "%8.2f", 100.0 * t->mperf/t->tsc); 508 outp += sprintf(outp, "%8.2f", 100.0 * t->mperf/t->tsc/tsc_tweak);
506 else 509 else
507 outp += sprintf(outp, "********"); 510 outp += sprintf(outp, "********");
508 } 511 }
@@ -510,7 +513,7 @@ int format_counters(struct thread_data *t, struct core_data *c,
510 /* Bzy_MHz */ 513 /* Bzy_MHz */
511 if (has_aperf) 514 if (has_aperf)
512 outp += sprintf(outp, "%8.0f", 515 outp += sprintf(outp, "%8.0f",
513 1.0 * t->tsc / units * t->aperf / t->mperf / interval_float); 516 1.0 * t->tsc * tsc_tweak / units * t->aperf / t->mperf / interval_float);
514 517
515 /* TSC_MHz */ 518 /* TSC_MHz */
516 outp += sprintf(outp, "%8.0f", 1.0 * t->tsc/units/interval_float); 519 outp += sprintf(outp, "%8.0f", 1.0 * t->tsc/units/interval_float);
@@ -984,6 +987,8 @@ int get_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p)
984 return -3; 987 return -3;
985 if (get_msr(cpu, MSR_IA32_MPERF, &t->mperf)) 988 if (get_msr(cpu, MSR_IA32_MPERF, &t->mperf))
986 return -4; 989 return -4;
990 t->aperf = t->aperf * aperf_mperf_multiplier;
991 t->mperf = t->mperf * aperf_mperf_multiplier;
987 } 992 }
988 993
989 if (do_smi) { 994 if (do_smi) {
@@ -1149,6 +1154,19 @@ int slv_pkg_cstate_limits[16] = {PCL__0, PCL__1, PCLRSV, PCLRSV, PCL__4, PCLRSV,
1149int amt_pkg_cstate_limits[16] = {PCL__0, PCL__1, PCL__2, PCLRSV, PCLRSV, PCLRSV, PCL__6, PCL__7, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV}; 1154int amt_pkg_cstate_limits[16] = {PCL__0, PCL__1, PCL__2, PCLRSV, PCLRSV, PCLRSV, PCL__6, PCL__7, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV};
1150int phi_pkg_cstate_limits[16] = {PCL__0, PCL__2, PCL_6N, PCL_6R, PCLRSV, PCLRSV, PCLRSV, PCLUNL, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV}; 1155int phi_pkg_cstate_limits[16] = {PCL__0, PCL__2, PCL_6N, PCL_6R, PCLRSV, PCLRSV, PCLRSV, PCLUNL, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV, PCLRSV};
1151 1156
1157
1158static void
1159calculate_tsc_tweak()
1160{
1161 unsigned long long msr;
1162 unsigned int base_ratio;
1163
1164 get_msr(base_cpu, MSR_NHM_PLATFORM_INFO, &msr);
1165 base_ratio = (msr >> 8) & 0xFF;
1166 base_hz = base_ratio * bclk * 1000000;
1167 tsc_tweak = base_hz / tsc_hz;
1168}
1169
1152static void 1170static void
1153dump_nhm_platform_info(void) 1171dump_nhm_platform_info(void)
1154{ 1172{
@@ -1926,8 +1944,6 @@ int has_config_tdp(unsigned int family, unsigned int model)
1926 1944
1927 switch (model) { 1945 switch (model) {
1928 case 0x3A: /* IVB */ 1946 case 0x3A: /* IVB */
1929 case 0x3E: /* IVB Xeon */
1930
1931 case 0x3C: /* HSW */ 1947 case 0x3C: /* HSW */
1932 case 0x3F: /* HSX */ 1948 case 0x3F: /* HSX */
1933 case 0x45: /* HSW */ 1949 case 0x45: /* HSW */
@@ -2543,6 +2559,13 @@ int is_knl(unsigned int family, unsigned int model)
2543 return 0; 2559 return 0;
2544} 2560}
2545 2561
2562unsigned int get_aperf_mperf_multiplier(unsigned int family, unsigned int model)
2563{
2564 if (is_knl(family, model))
2565 return 1024;
2566 return 1;
2567}
2568
2546#define SLM_BCLK_FREQS 5 2569#define SLM_BCLK_FREQS 5
2547double slm_freq_table[SLM_BCLK_FREQS] = { 83.3, 100.0, 133.3, 116.7, 80.0}; 2570double slm_freq_table[SLM_BCLK_FREQS] = { 83.3, 100.0, 133.3, 116.7, 80.0};
2548 2571
@@ -2744,6 +2767,9 @@ void process_cpuid()
2744 } 2767 }
2745 } 2768 }
2746 2769
2770 if (has_aperf)
2771 aperf_mperf_multiplier = get_aperf_mperf_multiplier(family, model);
2772
2747 do_nhm_platform_info = do_nhm_cstates = do_smi = probe_nhm_msrs(family, model); 2773 do_nhm_platform_info = do_nhm_cstates = do_smi = probe_nhm_msrs(family, model);
2748 do_snb_cstates = has_snb_msrs(family, model); 2774 do_snb_cstates = has_snb_msrs(family, model);
2749 do_pc2 = do_snb_cstates && (pkg_cstate_limit >= PCL__2); 2775 do_pc2 = do_snb_cstates && (pkg_cstate_limit >= PCL__2);
@@ -2762,6 +2788,9 @@ void process_cpuid()
2762 if (debug) 2788 if (debug)
2763 dump_cstate_pstate_config_info(); 2789 dump_cstate_pstate_config_info();
2764 2790
2791 if (has_skl_msrs(family, model))
2792 calculate_tsc_tweak();
2793
2765 return; 2794 return;
2766} 2795}
2767 2796
@@ -3090,7 +3119,7 @@ int get_and_dump_counters(void)
3090} 3119}
3091 3120
3092void print_version() { 3121void print_version() {
3093 fprintf(stderr, "turbostat version 4.7 17-June, 2015" 3122 fprintf(stderr, "turbostat version 4.8 26-Sep, 2015"
3094 " - Len Brown <lenb@kernel.org>\n"); 3123 " - Len Brown <lenb@kernel.org>\n");
3095} 3124}
3096 3125