summaryrefslogtreecommitdiff
path: root/drivers/powercap/intel_rapl_msr.c
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2020-10-13 15:42:41 +0800
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2020-10-16 17:35:36 +0200
commitf1e8d7560d3051b38f73a0cf6acc1b0bf5305ad9 (patch)
treef585f43c5fac9f2f864029402f7e1da33e48b9a1 /drivers/powercap/intel_rapl_msr.c
parent7a57e9f112adebc9e5dc787c2a59dbc06ae5060d (diff)
downloadlwn-f1e8d7560d3051b38f73a0cf6acc1b0bf5305ad9.tar.gz
lwn-f1e8d7560d3051b38f73a0cf6acc1b0bf5305ad9.zip
powercap/intel_rapl: enumerate Psys RAPL domain together with package RAPL domain
On multi-package systems, the Psys MSR is only valid for CPUs on specific package (master package). The current code makes the assumption that package 0 is the master package, but this is not true on new platforms like SPR. Fix the problem by emuerating the Psys RAPL domain for every package, so CPUs in slave packages will read 0 for the Psys energy counter and only CPUs in master packages can get a valid reading and register the Psys RAPL domain. The sysfs I/F for the Psys RAPL domain is not changed. Signed-off-by: Zhang Rui <rui.zhang@intel.com> [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/powercap/intel_rapl_msr.c')
-rw-r--r--drivers/powercap/intel_rapl_msr.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/powercap/intel_rapl_msr.c b/drivers/powercap/intel_rapl_msr.c
index d2a2627507a9..1646808d354c 100644
--- a/drivers/powercap/intel_rapl_msr.c
+++ b/drivers/powercap/intel_rapl_msr.c
@@ -44,6 +44,7 @@ static struct rapl_if_priv rapl_msr_priv = {
.regs[RAPL_DOMAIN_PLATFORM] = {
MSR_PLATFORM_POWER_LIMIT, MSR_PLATFORM_ENERGY_STATUS, 0, 0, 0},
.limits[RAPL_DOMAIN_PACKAGE] = 2,
+ .limits[RAPL_DOMAIN_PLATFORM] = 2,
};
/* Handles CPU hotplug on multi-socket systems.
@@ -157,9 +158,6 @@ static int rapl_msr_probe(struct platform_device *pdev)
goto out;
rapl_msr_priv.pcap_rapl_online = ret;
- /* Don't bail out if PSys is not supported */
- rapl_add_platform_domain(&rapl_msr_priv);
-
return 0;
out:
@@ -171,7 +169,6 @@ out:
static int rapl_msr_remove(struct platform_device *pdev)
{
cpuhp_remove_state(rapl_msr_priv.pcap_rapl_online);
- rapl_remove_platform_domain(&rapl_msr_priv);
powercap_unregister_control_type(rapl_msr_priv.control_type);
return 0;
}