powercap/intel_rapl: enumerate Psys RAPL domain together with package RAPL domain
authorZhang Rui <rui.zhang@intel.com>
Tue, 13 Oct 2020 07:42:41 +0000 (15:42 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 16 Oct 2020 15:35:36 +0000 (17:35 +0200)
commitf1e8d7560d3051b38f73a0cf6acc1b0bf5305ad9
treef585f43c5fac9f2f864029402f7e1da33e48b9a1
parent7a57e9f112adebc9e5dc787c2a59dbc06ae5060d
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>
drivers/powercap/intel_rapl_common.c
drivers/powercap/intel_rapl_msr.c
include/linux/intel_rapl.h