Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit a91c6e1

Browse files
zhang-ruigregkh
authored andcommitted
powercap: intel_rapl_tpmi: Ignore minor version change
[ Upstream commit 1d39092 ] The hardware definition of every TPMI feature contains a major and minor version. When there is a change in the MMIO offset or change in the definition of a field, hardware will change major version. For addition of new fields without modifying existing MMIO offsets or fields, only the minor version is changed. If the driver has not been updated to recognize a new hardware major version, it cannot provide the RAPL interface to users due to possible register layout incompatibilities. However, the driver does not need to be updated every time the hardware minor version changes because in that case it will just miss some new functionality exposed by the hardware. The current implementation causes the driver to refuse to work for any hardware version change which is unnecessarily restrictive. If there is a minor version mismatch, log an information message and continue, but if there is a major version mismatch, log a warning and exit (as before). Signed-off-by: Zhang Rui <[email protected]> Reviewed-by: Srinivas Pandruvada <[email protected]> Link: https://patch.msgid.link/[email protected] Fixes: 9eef7f9 ("powercap: intel_rapl: Introduce RAPL TPMI interface driver") [ rjw: Changelog edits ] Signed-off-by: Rafael J. Wysocki <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent f0a6c43 commit a91c6e1

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

drivers/powercap/intel_rapl_tpmi.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
#include <linux/module.h>
1616
#include <linux/slab.h>
1717

18-
#define TPMI_RAPL_VERSION 1
18+
#define TPMI_RAPL_MAJOR_VERSION 0
19+
#define TPMI_RAPL_MINOR_VERSION 1
1920

2021
/* 1 header + 10 registers + 5 reserved. 8 bytes for each. */
2122
#define TPMI_RAPL_DOMAIN_SIZE 128
@@ -154,11 +155,21 @@ static int parse_one_domain(struct tpmi_rapl_package *trp, u32 offset)
154155
tpmi_domain_size = tpmi_domain_header >> 16 & 0xff;
155156
tpmi_domain_flags = tpmi_domain_header >> 32 & 0xffff;
156157

157-
if (tpmi_domain_version != TPMI_RAPL_VERSION) {
158-
pr_warn(FW_BUG "Unsupported version:%d\n", tpmi_domain_version);
158+
if (tpmi_domain_version == TPMI_VERSION_INVALID) {
159+
pr_warn(FW_BUG "Invalid version\n");
159160
return -ENODEV;
160161
}
161162

163+
if (TPMI_MAJOR_VERSION(tpmi_domain_version) != TPMI_RAPL_MAJOR_VERSION) {
164+
pr_warn(FW_BUG "Unsupported major version:%ld\n",
165+
TPMI_MAJOR_VERSION(tpmi_domain_version));
166+
return -ENODEV;
167+
}
168+
169+
if (TPMI_MINOR_VERSION(tpmi_domain_version) > TPMI_RAPL_MINOR_VERSION)
170+
pr_info("Ignore: Unsupported minor version:%ld\n",
171+
TPMI_MINOR_VERSION(tpmi_domain_version));
172+
162173
/* Domain size: in unit of 128 Bytes */
163174
if (tpmi_domain_size != 1) {
164175
pr_warn(FW_BUG "Invalid Domain size %d\n", tpmi_domain_size);

0 commit comments

Comments
 (0)