2011-05-25 22:43:31 +04:00
Kernel driver fam15h_power
==========================
Supported chips:
2019-04-17 12:46:15 +03:00
2011-05-25 22:43:31 +04:00
* AMD Family 15h Processors
2019-04-17 12:46:15 +03:00
2015-08-27 11:07:37 +03:00
* AMD Family 16h Processors
2011-05-25 22:43:31 +04:00
Prefix: 'fam15h_power'
2019-04-17 12:46:15 +03:00
2011-05-25 22:43:31 +04:00
Addresses scanned: PCI space
2019-04-17 12:46:15 +03:00
2011-05-25 22:43:31 +04:00
Datasheets:
2019-04-17 12:46:15 +03:00
- BIOS and Kernel Developer's Guide (BKDG) For AMD Family 15h Processors
- BIOS and Kernel Developer's Guide (BKDG) For AMD Family 16h Processors
- AMD64 Architecture Programmer's Manual Volume 2: System Programming
2011-05-25 22:43:31 +04:00
2012-10-29 21:50:47 +04:00
Author: Andreas Herrmann <herrmann.der.user@googlemail.com>
2011-05-25 22:43:31 +04:00
Description
-----------
2016-04-06 10:44:14 +03:00
1) Processor TDP (Thermal design power)
Given a fixed frequency and voltage, the power consumption of a
processor varies based on the workload being executed. Derated power
is the power consumed when running a specific application. Thermal
design power (TDP) is an example of derated power.
2011-05-25 22:43:31 +04:00
This driver permits reading of registers providing power information
2016-04-06 10:44:14 +03:00
of AMD Family 15h and 16h processors via TDP algorithm.
2011-05-25 22:43:31 +04:00
2015-08-27 11:07:37 +03:00
For AMD Family 15h and 16h processors the following power values can
be calculated using different processor northbridge function
registers:
2011-05-25 22:43:31 +04:00
2019-04-17 12:46:15 +03:00
* BasePwrWatts:
Specifies in watts the maximum amount of power
consumed by the processor for NB and logic external to the core.
* ProcessorPwrWatts:
Specifies in watts the maximum amount of power
the processor can support.
* CurrPwrWatts:
Specifies in watts the current amount of power being
consumed by the processor.
2011-05-25 22:43:31 +04:00
This driver provides ProcessorPwrWatts and CurrPwrWatts:
2019-04-17 12:46:15 +03:00
2011-05-25 22:43:31 +04:00
* power1_crit (ProcessorPwrWatts)
* power1_input (CurrPwrWatts)
On multi-node processors the calculated value is for the entire
package and not for a single node. Thus the driver creates sysfs
attributes only for internal node0 of a multi-node processor.
2016-04-06 10:44:14 +03:00
2) Accumulated Power Mechanism
This driver also introduces an algorithm that should be used to
calculate the average power consumed by a processor during a
measurement interval Tm. The feature of accumulated power mechanism is
indicated by CPUID Fn8000_0007_EDX[12].
2019-04-17 12:46:15 +03:00
* Tsample:
compute unit power accumulator sample period
* Tref:
the PTSC counter period
* PTSC:
performance timestamp counter
* N:
the ratio of compute unit power accumulator sample period to the
PTSC period
* Jmax:
max compute unit accumulated power which is indicated by
MaxCpuSwPwrAcc MSR C001007b
* Jx/Jy:
compute unit accumulated power which is indicated by
CpuSwPwrAcc MSR C001007a
* Tx/Ty:
the value of performance timestamp counter which is indicated
by CU_PTSC MSR C0010280
* PwrCPUave:
CPU average power
2016-04-06 10:44:14 +03:00
i. Determine the ratio of Tsample to Tref by executing CPUID Fn8000_0007.
2019-04-17 12:46:15 +03:00
2016-04-06 10:44:14 +03:00
N = value of CPUID Fn8000_0007_ECX[CpuPwrSampleTimeRatio[15:0]].
ii. Read the full range of the cumulative energy value from the new
2019-04-17 12:46:15 +03:00
MSR MaxCpuSwPwrAcc.
2016-04-06 10:44:14 +03:00
Jmax = value returned.
2019-04-17 12:46:15 +03:00
2016-04-06 10:44:14 +03:00
iii. At time x, SW reads CpuSwPwrAcc MSR and samples the PTSC.
2019-04-17 12:46:15 +03:00
Jx = value read from CpuSwPwrAcc and Tx = value read from PTSC.
2016-04-06 10:44:14 +03:00
iv. At time y, SW reads CpuSwPwrAcc MSR and samples the PTSC.
2019-04-17 12:46:15 +03:00
Jy = value read from CpuSwPwrAcc and Ty = value read from PTSC.
2016-04-06 10:44:14 +03:00
v. Calculate the average power consumption for a compute unit over
2019-04-17 12:46:15 +03:00
time period (y-x). Unit of result is uWatt::
2016-04-06 10:44:14 +03:00
if (Jy < Jx) // Rollover has occurred
Jdelta = (Jy + Jmax) - Jx
else
Jdelta = Jy - Jx
PwrCPUave = N * Jdelta * 1000 / (Ty - Tx)
This driver provides PwrCPUave and interval(default is 10 millisecond
and maximum is 1 second):
2019-04-17 12:46:15 +03:00
2016-04-06 10:44:14 +03:00
* power1_average (PwrCPUave)
* power1_average_interval (Interval)
The power1_average_interval can be updated at /etc/sensors3.conf file
as below:
2019-04-17 12:46:15 +03:00
chip `fam15h_power-*`
2016-04-06 10:44:14 +03:00
set power1_average_interval 0.01
Then save it with "sensors -s".