Skip to content

Commit 05d92ee

Browse files
Jarred Whiterafaeljw
authored andcommitted
ACPI: CPPC: Fix bit_offset shift in MASK_VAL() macro
Commit 2f4a4d6 ("ACPI: CPPC: Use access_width over bit_width for system memory accesses") neglected to properly wrap the bit_offset shift when it comes to applying the mask. This may cause incorrect values to be read and may cause the cpufreq module not be loaded. [ 11.059751] cpu_capacity: CPU0 missing/invalid highest performance. [ 11.066005] cpu_capacity: partial information: fallback to 1024 for all CPUs Also, corrected the bitmask generation in GENMASK (extra bit being added). Fixes: 2f4a4d6 ("ACPI: CPPC: Use access_width over bit_width for system memory accesses") Signed-off-by: Jarred White <[email protected]> Cc: 5.15+ <[email protected]> # 5.15+ Reviewed-by: Vanshidhar Konda <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent ed30a4a commit 05d92ee

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/acpi/cppc_acpi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ show_cppc_data(cppc_get_perf_ctrs, cppc_perf_fb_ctrs, wraparound_time);
170170
#define GET_BIT_WIDTH(reg) ((reg)->access_width ? (8 << ((reg)->access_width - 1)) : (reg)->bit_width)
171171

172172
/* Shift and apply the mask for CPC reads/writes */
173-
#define MASK_VAL(reg, val) ((val) >> ((reg)->bit_offset & \
174-
GENMASK(((reg)->bit_width), 0)))
173+
#define MASK_VAL(reg, val) (((val) >> (reg)->bit_offset) & \
174+
GENMASK(((reg)->bit_width) - 1, 0))
175175

176176
static ssize_t show_feedback_ctrs(struct kobject *kobj,
177177
struct kobj_attribute *attr, char *buf)

0 commit comments

Comments
 (0)