From: Easwar Hariharan <eahariha@linux.microsoft.com>
To: stable@vger.kernel.org
Cc: Jarred White <jarredwhite@linux.microsoft.com>,
Vanshidhar Konda <vanshikonda@os.amperecomputing.com>,
"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
Easwar Hariharan <eahariha@linux.microsoft.com>
Subject: [PATCH RESEND 5.15.y 2/3] ACPI: CPPC: Fix bit_offset shift in MASK_VAL() macro
Date: Thu, 9 May 2024 19:41:25 +0000 [thread overview]
Message-ID: <20240509194126.3020424-3-eahariha@linux.microsoft.com> (raw)
In-Reply-To: <20240509194126.3020424-1-eahariha@linux.microsoft.com>
From: Jarred White <jarredwhite@linux.microsoft.com>
commit 05d92ee782eeb7b939bdd0189e6efcab9195bf95 upstream
Commit 2f4a4d63a193 ("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: 2f4a4d63a193 ("ACPI: CPPC: Use access_width over bit_width for system memory accesses")
Signed-off-by: Jarred White <jarredwhite@linux.microsoft.com>
Cc: 5.15+ <stable@vger.kernel.org> # 5.15+
Reviewed-by: Vanshidhar Konda <vanshikonda@os.amperecomputing.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
---
drivers/acpi/cppc_acpi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
index 408b1fda5702d..6aa456cda0ed9 100644
--- a/drivers/acpi/cppc_acpi.c
+++ b/drivers/acpi/cppc_acpi.c
@@ -165,8 +165,8 @@ show_cppc_data(cppc_get_perf_ctrs, cppc_perf_fb_ctrs, wraparound_time);
#define GET_BIT_WIDTH(reg) ((reg)->access_width ? (8 << ((reg)->access_width - 1)) : (reg)->bit_width)
/* Shift and apply the mask for CPC reads/writes */
-#define MASK_VAL(reg, val) ((val) >> ((reg)->bit_offset & \
- GENMASK(((reg)->bit_width), 0)))
+#define MASK_VAL(reg, val) (((val) >> (reg)->bit_offset) & \
+ GENMASK(((reg)->bit_width) - 1, 0))
static ssize_t show_feedback_ctrs(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
--
2.34.1
next prev parent reply other threads:[~2024-05-09 19:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-09 19:41 [PATCH RESEND 5.15.y 0/3] Use access_width for _CPC package when provided by the platform firmware Easwar Hariharan
2024-05-09 19:41 ` [PATCH RESEND 5.15.y 1/3] Revert "Revert "ACPI: CPPC: Use access_width over bit_width for system memory accesses"" Easwar Hariharan
2024-05-09 19:41 ` Easwar Hariharan [this message]
2024-05-09 19:41 ` [PATCH RESEND 5.15.y 3/3] ACPI: CPPC: Fix access width used for PCC registers Easwar Hariharan
2024-05-11 13:25 ` [PATCH RESEND 5.15.y 0/3] Use access_width for _CPC package when provided by the platform firmware Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240509194126.3020424-3-eahariha@linux.microsoft.com \
--to=eahariha@linux.microsoft.com \
--cc=jarredwhite@linux.microsoft.com \
--cc=rafael.j.wysocki@intel.com \
--cc=stable@vger.kernel.org \
--cc=vanshikonda@os.amperecomputing.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox