aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/fam15h_power.c
diff options
context:
space:
mode:
authorHuang Rui <ray.huang@amd.com>2016-04-06 15:44:12 +0800
committerGuenter Roeck <linux@roeck-us.net>2016-04-19 06:32:35 -0700
commitcdb9e110b10a08b7e1371356c2c03c73eb4f93d5 (patch)
tree08efb905712d3470841a4ec0488221e9e08e49ab /drivers/hwmon/fam15h_power.c
parenthwmon: (fam15h_power) Add compute unit accumulated power (diff)
downloadlinux-dev-cdb9e110b10a08b7e1371356c2c03c73eb4f93d5.tar.xz
linux-dev-cdb9e110b10a08b7e1371356c2c03c73eb4f93d5.zip
hwmon: (fam15h_power) Add ptsc counter value for accumulated power
PTSC is the performance timestamp counter value in a cpu core and the cores in one compute unit have the fixed frequency. So it picks up the performance timestamp counter value of the first core per compute unit to measure the interval for average power per compute unit. Signed-off-by: Huang Rui <ray.huang@amd.com> Cc: Borislav Petkov <bp@alien8.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/fam15h_power.c')
-rw-r--r--drivers/hwmon/fam15h_power.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c
index 4edbaf083130..336d422fb863 100644
--- a/drivers/hwmon/fam15h_power.c
+++ b/drivers/hwmon/fam15h_power.c
@@ -50,6 +50,7 @@ MODULE_LICENSE("GPL");
#define MSR_F15H_CU_PWR_ACCUMULATOR 0xc001007a
#define MSR_F15H_CU_MAX_PWR_ACCUMULATOR 0xc001007b
+#define MSR_F15H_PTSC 0xc0010280
#define PCI_DEVICE_ID_AMD_15H_M70H_NB_F4 0x15b4
@@ -65,6 +66,8 @@ struct fam15h_power_data {
u64 max_cu_acc_power;
/* accumulated power of the compute units */
u64 cu_acc_power[MAX_CUS];
+ /* performance timestamp counter */
+ u64 cpu_sw_pwr_ptsc[MAX_CUS];
};
static ssize_t show_power(struct device *dev,
@@ -145,6 +148,7 @@ static void do_read_registers_on_cu(void *_data)
cu = cpu_data(cpu).cpu_core_id;
rdmsrl_safe(MSR_F15H_CU_PWR_ACCUMULATOR, &data->cu_acc_power[cu]);
+ rdmsrl_safe(MSR_F15H_PTSC, &data->cpu_sw_pwr_ptsc[cu]);
}
/*