summaryrefslogtreecommitdiffstats
path: root/drivers/powercap
Commit message (Collapse)AuthorAgeFilesLines
* powercap/rapl: track lead cpu per packageJacob Pan2016-03-091-39/+20
| | | | | | | | | | | | | | | | RAPL driver operates on MSRs that are under package/socket scope instead of core scope. However, the current code does not keep track of which CPUs are available on each package for MSR access. Therefore it has to search for an active CPU on a given package each time. This patch optimizes the package level operations by tracking a per package lead CPU during initialization and CPU hotplug. The runtime search for active CPU is avoided. Suggested-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* powercap/rapl: add package reference per domainJacob Pan2016-03-091-45/+21
| | | | | | | | | | This patch adds to each rapl domain a reference of the package it belongs to. At runtime, we can then avoid searching the package data for each access. It simplifies the domain level operations which depend on package level information. Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* powercap/rapl: reduce ipi callsJacob Pan2016-03-091-34/+85
| | | | | | | | | Reduce remote CPU calls for MSR access by combining read modify write into one function. Suggested-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* Merge branch 'powercap'Rafael J. Wysocki2016-01-122-11/+11
|\ | | | | | | | | * powercap: powercap: constify powercap_zone_ops and powercap_zone_constraint_ops structures
| * powercap: constify powercap_zone_ops and powercap_zone_constraint_ops structuresJulia Lawall2016-01-022-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | The powercap_zone_ops and powercap_zone_constraint_ops structures are never modified, so declare them as const. Most of the actual changes adjust indentation to accomodate the const keyword. Done with the help of Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* | Merge branch 'acpi-soc'Rafael J. Wysocki2016-01-121-5/+5
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * acpi-soc: PM / clk: don't leave clocks enabled when driver not bound i2c: dw: Add APM X-Gene ACPI I2C device support ACPI / APD: Add APM X-Gene ACPI I2C device support ACPI / LPSS: change 'does not have' to 'has' in comment Revert "dmaengine: dw: platform: provide platform data for Intel" dmaengine: dw: return immediately from IRQ when DMA isn't in use dmaengine: dw: platform: power on device on shutdown ACPI / LPSS: override power state for LPSS DMA device ACPI / LPSS: power on when probe() and otherwise when remove() ACPI / LPSS: do delay for all LPSS devices when D3->D0 ACPI / LPSS: allow to use specific PM domain during ->probe() Revert "ACPI / LPSS: allow to use specific PM domain during ->probe()" device core: add BUS_NOTIFY_DRIVER_NOT_BOUND notification x86/platform/iosf_mbi: Remove duplicate definitions Conflicts: drivers/i2c/busses/i2c-designware-platdrv.c
| * x86/platform/iosf_mbi: Remove duplicate definitionsAndy Shevchenko2015-12-091-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The read and write opcodes are global for all units on SoC and even across Intel SoCs. Remove duplication of corresponding constants. At the same time convert all current users. No functional change. Acked-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Boon Leong Ong <boon.leong.ong@intel.com> Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* | powercap / RAPL: fix BIOS lock checkPrarit Bhargava2015-12-121-2/+5
|/ | | | | | | | | | | | | | | | | | | Intel RAPL initialized on several systems where the BIOS lock bit (msr 0x610, bit 63) was set. This occured because the return value of rapl_read_data_raw() was being checked, rather than the value of the variable passed in, locked. This patch properly implments the rapl_read_data_raw() call to check the variable locked, and now the Intel RAPL driver outputs the warning: intel_rapl: RAPL package 0 domain package locked by BIOS and does not initialize for the package. Signed-off-by: Prarit Bhargava <prarit@redhat.com> Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Cc: All applicable <stable@vger.kernel.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* powercap / RAPL: Enable Broxton RAPL supportAmy Wiles2015-10-161-0/+1
| | | | | | | | Broxton CPU ID for the RAPL driver. Signed-off-by: Amy Wiles <amy.l.wiles@intel.com> [ rjw: Subject and changelog. ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* powercap / RAPL: disable the 2nd power limit properlySeiichi Ikarashi2015-08-291-2/+4
| | | | | | | | | | Let rapl_unregister_powercap() disable the second power limit only if it exists. Intel64 SDM Vol.3 14.9 says that the package domain has it but neither the power plane domain nor the DRAM domain has it. Signed-off-by: Seiichi Ikarashi <s.ikarashi@jp.fujitsu.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* powercap / RAPL: Add support for Broadwell-HRadivoje Jovanovic2015-08-011-0/+1
| | | | | | | This patch enabled RAPL to support Broadwell-H Signed-off-by: Radivoje Jovanovic <radivoje.jovanovic@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* powercap / RAPL: Add support for Skylake H/SRadivoje Jovanovic2015-08-011-0/+1
| | | | | | | This patche enabled RAPL to support Intel Skylake H/S Signed-off-by: Radivoje Jovanovic <radivoje.jovanovic@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* powercap / RAPL: Support Knights LandingDasaratharaman Chandramouli2015-05-211-0/+1
| | | | | | | | | | This patch enables intel_rapl driver to run on the next-generation Intel(R) Xeon Phi Microarchitecture code named "Knights Landing" Signed-off-by: Dasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com> Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* powercap / RAPL: Floor frequency setting in Atom SoCAjay Thomas2015-05-051-9/+41
| | | | | | | | | | | | | | | | | | CPU Floor frequency is set in BIOS for newer Atom SoCs. This patch handles configuration of floor frequency for different variants of Atom SoCs appropriately and ensures configuration of floor frequency is not done from driver for these newer Atom SoCs. Since address of the register for configuring floor frequency might change for different Atom SoCs, this patch also prevents potential overwriting of wrong registers. Reviewed-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Ajay Thomas <ajay.thomas.david.rajamanickam@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* powercap / RAPL: Add support for Intel Skylake processorsBrian Bian2015-04-151-0/+1
| | | | | | Signed-off-by: Brian Bian <brian.bian@intel.com> Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* powercap / RAPL: mark rapl_ids array as __initconstMathias Krause2015-04-111-1/+1
| | | | | | | | | | | | The RAPL ids are only tested in rapl_init() which is itself an __init function. For the MODULE_DEVICE_TABLE() file2alias doesn't care about the section, just about the symbol name. Therefore it's safe to mark the rapl_ids[] array as __initconst so its memory can be released after initialization is done. Signed-off-by: Mathias Krause <minipli@googlemail.com> Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* powercap / RAPL: add ID for Broadwell serverJacob Pan2015-04-111-0/+1
| | | | | | | Validated RAPL functions on this platform. Add support to driver. Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* powercap / RAPL: handle domains with different energy unitsJacob Pan2015-03-131-15/+39
| | | | | | | | | | | | | | | | | | | | | | The current driver assumes all RAPL domains within a CPU package have the same energy unit. This is no longer true for HSW server CPUs since DRAM domain has is own fixed energy unit which can be different than the package energy unit enumerated by package power MSR. In fact, the default HSW EP package power unit is 61uJ whereas DRAM domain unit is 15.3uJ. The result is that DRAM power consumption is counted 4x more than real power reported by energy counters, similarly for max_energy_range_uj of DRAM domain. This patch adds domain specific energy unit per cpu type, it allows domain energy unit to override package energy unit if non zero. Please see this document for details. "Intel Xeon Processor E5-1600 and E5-2600 v3 Product Families, Volume 2 of 2. Datasheet, September 2014, Reference Number: 330784-001 " Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Cc: 3.10+ <stable@vger.kernel.org> # 3.10+ Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* powercap / RAPL: add IDs for future Xeon CPUsJacob Pan2014-12-171-0/+1
| | | | | | | Enable RAPL driver on Xeon cpu id 0x56. Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* powercap / RAPL: fix build dependency on iosf_mbiJacob Pan2014-11-121-1/+1
| | | | | | | | | RAPL on Atom depends on IOSF_MBI driver for setting floor frequency. This patch adds explicit dependency on CONFIG_IOSF_MB. Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* powercap / RAPL: add new model idsJacob Pan2014-11-111-0/+3
| | | | | Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* powercap / RAPL: handle atom and core differencesJacob Pan2014-11-111-77/+139
| | | | | | | | | | | | | | RAPL implementation on Atom has made some changes that are not compatible with Core CPUs. Specifically, it is different in the way units are computed as well as floor frequency is enforced. This patch uses the per CPU model functions to handle the differences. Intel Software Developers' Manual has also been updated to reflect the changes in Table 35-7 V3C. Signed-off-by: Ajay Thomas <ajay.thomas.david.rajamanickam@intel.com> Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* powercap / RAPL: abstract per cpu type functionsJacob Pan2014-11-111-10/+35
| | | | | | | | | | | RAPL implementations may vary slightly between Core and Atom CPUs. There are also potential differences among generations of CPUs within the family. This patch adds a per model structure to abstract the differences such that variations can be handled cleanly. Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* powercap / RAPL: change domain detection messageJacob Pan2014-09-031-4/+3
| | | | | | | | | | | | | | | Many CPUs do not support complete set of RAPL domains, as a result this detection failed message is very misleading and can be annoying. [ 5.082632] intel_rapl: RAPL domain core detection failed [ 5.088370] intel_rapl: RAPL domain uncore detection failed So lower the warning message to info and only print out the RAPL domains that are supported. Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* powercap / RAPL: add support for CPU model 0x3fJason Baron2014-09-031-0/+1
| | | | | | | | | | | | | I've confirmed that monitoring the package power usage as well as setting power limits appear to be working as expected. Supports the package and dram domains. Tested aginst cpu: Intel(R) Xeon(R) CPU E5-2650 v3 @ 2.30GHz Signed-off-by: Jason Baron <jbaron@akamai.com> Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* powercap / RAPL: add new CPU IDsJacob Pan2014-05-011-1/+3
| | | | | | | Add support for Broadwell model 0x3d and Haswell model (0x3c). Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* powercap / RAPL: further relax energy counter checksJacob Pan2014-05-011-20/+9
| | | | | | | | | | | | Energy counters may roll slowly for some RAPL domains, checking all of them can be time consuming and takes unpredictable amount of time. Therefore, we relax the sanity check by only checking availability of the MSRs and non-zero value of the energy status counters. It has been shown sufficient for all the platforms tested to filter out inactive domains. Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Acked-by: Durgadoss R <durgadoss.r@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* Merge tag 'cpu-hotplug-3.15-rc1' of ↵Linus Torvalds2014-04-071-2/+8
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm Pull CPU hotplug notifiers registration fixes from Rafael Wysocki: "The purpose of this single series of commits from Srivatsa S Bhat (with a small piece from Gautham R Shenoy) touching multiple subsystems that use CPU hotplug notifiers is to provide a way to register them that will not lead to deadlocks with CPU online/offline operations as described in the changelog of commit 93ae4f978ca7f ("CPU hotplug: Provide lockless versions of callback registration functions"). The first three commits in the series introduce the API and document it and the rest simply goes through the users of CPU hotplug notifiers and converts them to using the new method" * tag 'cpu-hotplug-3.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (52 commits) net/iucv/iucv.c: Fix CPU hotplug callback registration net/core/flow.c: Fix CPU hotplug callback registration mm, zswap: Fix CPU hotplug callback registration mm, vmstat: Fix CPU hotplug callback registration profile: Fix CPU hotplug callback registration trace, ring-buffer: Fix CPU hotplug callback registration xen, balloon: Fix CPU hotplug callback registration hwmon, via-cputemp: Fix CPU hotplug callback registration hwmon, coretemp: Fix CPU hotplug callback registration thermal, x86-pkg-temp: Fix CPU hotplug callback registration octeon, watchdog: Fix CPU hotplug callback registration oprofile, nmi-timer: Fix CPU hotplug callback registration intel-idle: Fix CPU hotplug callback registration clocksource, dummy-timer: Fix CPU hotplug callback registration drivers/base/topology.c: Fix CPU hotplug callback registration acpi-cpufreq: Fix CPU hotplug callback registration zsmalloc: Fix CPU hotplug callback registration scsi, fcoe: Fix CPU hotplug callback registration scsi, bnx2fc: Fix CPU hotplug callback registration scsi, bnx2i: Fix CPU hotplug callback registration ...
| * powercap, intel-rapl: Fix CPU hotplug callback registrationSrivatsa S. Bhat2014-03-201-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Subsystems that want to register CPU hotplug callbacks, as well as perform initialization for the CPUs that are already online, often do it as shown below: get_online_cpus(); for_each_online_cpu(cpu) init_cpu(cpu); register_cpu_notifier(&foobar_cpu_notifier); put_online_cpus(); This is wrong, since it is prone to ABBA deadlocks involving the cpu_add_remove_lock and the cpu_hotplug.lock (when running concurrently with CPU hotplug operations). Instead, the correct and race-free way of performing the callback registration is: cpu_notifier_register_begin(); for_each_online_cpu(cpu) init_cpu(cpu); /* Note the use of the double underscored version of the API */ __register_cpu_notifier(&foobar_cpu_notifier); cpu_notifier_register_done(); Fix the intel-rapl code in the powercap driver by using this latter form of callback registration. But retain the calls to get/put_online_cpus(), since they also protect the function rapl_cleanup_data(). By nesting get/put_online_cpus() *inside* cpu_notifier_register_begin/done(), we avoid the ABBA deadlock possibility mentioned above. Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Cc: Ingo Molnar <mingo@kernel.org> Tested-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* | powercap / intel_rapl: spell out SoC namesJacob Pan2014-02-141-6/+6
| | | | | | | | | | | | | | Spell out names for supported SoCs. Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* | powercap / intel_rapl: relax sanity check on energy countersJacob Pan2014-02-141-0/+5
|/ | | | | | | | | | | | | Some RAPL domains may not be active at the time driver is being loaded. Checking energy counter increment may be too strict and time consuming. So relax the sanity check on energy counters of these domains. Otherwise, they may be ignored and become unavailable to the powercap framework. Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* powercap / RAPL: add support for ValleyView SocJacob Pan2013-12-221-2/+11
| | | | | | | | | | | This patch adds support for RAPL on Intel ValleyView based SoC platforms, such as Baytrail. Besides adding CPU ID, special energy unit encoding is handled for ValleyView. Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* PowerCap: Fix mode for energy counterSrinivas Pandruvada2013-12-051-1/+6
| | | | | | | | | | | As per the documentation of powercap sysfs, energy_uj field is read only, if it can't be reset. Currently it always allows write but will fail, if there is no reset callback. Changing mode field, to read only if there is no reset callback. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Reported-by: Dirk Brandewie <dirk.j.brandewie@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* PowerCap: Fix build error with option -Werror=format-securitySrinivas Pandruvada2013-11-051-1/+1
| | | | | | | | | | | Fix compile error with gcc option: -Werror=format-security for dev_set_name(&control_type->dev, name). Changed to dev_set_name(&control_type->dev, "%s", name). Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* PowerCap: Convert class code to use dev_groupsThierry Reding2013-10-251-5/+7
| | | | | | | | | | The newly added power capping framework uses the obsolete .dev_attrs field of struct class. However this field will be removed in 3.13, so convert the code to use the .dev_groups field instead. Signed-off-by: Thierry Reding <treding@nvidia.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* PowerCap: Introduce Intel RAPL power capping driverJacob Pan2013-10-183-0/+1409
| | | | | | | | | | | | | | | | | | | | | | | | | | The Intel Running Average Power Limit (RAPL) technology provides platform software with the ability to monitor, control, and get notifications on power usage. This feature is present in all Sandy Bridge and later Intel processors. Newer models allow more fine grained controls to be applied. In RAPL, power control is divided into domains, which include package, DRAM controller, CPU core (Power Plane 0), graphics uncore (power plane 1), etc. The purpose of this driver is to expose the RAPL settings to userspace. Overall, RAPL fits in the new powercap class driver in that platform level power capping controls are exposed via this generic interface. This driver is based on an earlier patch from Zhang Rui. However, while the previous work was mainly focused on thermal monitoring the focus here is on the usability from user space perspective. References: https://lkml.org/lkml/2011/5/26/93 Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* PowerCap: Add class driverSrinivas Pandruvada2013-10-173-0/+703
The power capping framework providing a consistent interface between the kernel and user space that allows power capping drivers to expose their settings to user space in a uniform way. The overall design of the framework is described in the documentation added by the previous patch in this series. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
OpenPOWER on IntegriCloud