From: Christian Loehle <christian.loehle@arm.com>
To: "Rafael J . Wysocki" <rafael@kernel.org>,
Viresh Kumar <viresh.kumar@linaro.org>
Cc: linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org, Len Brown <lenb@kernel.org>,
Jie Zhan <zhanjie9@hisilicon.com>,
Lifeng Zheng <zhenglifeng1@huawei.com>,
Pierre Gondois <pierre.gondois@arm.com>,
Sumit Gupta <sumitg@nvidia.com>,
Sudeep Holla <sudeep.holla@arm.com>,
Ionela Voinescu <ionela.voinescu@arm.com>,
zhongqiu.han@oss.qualcomm.com,
Christian Loehle <christian.loehle@arm.com>,
Sashiko <sashiko-bot@kernel.org>
Subject: [PATCH v6 04/15] ACPI: CPPC: Use 64-bit masks for register fields
Date: Sun, 30 Aug 2026 12:56:33 +0100 [thread overview]
Message-ID: <20260830115644.2056983-5-christian.loehle@arm.com> (raw)
In-Reply-To: <20260830115644.2056983-1-christian.loehle@arm.com>
MASK_VAL_READ() and MASK_VAL_WRITE() operate on u64 values but construct
their masks with GENMASK(), whose type is unsigned long. On 32-bit kernels
a field wider than 32 bits therefore produces an invalid shift or loses
its upper bits.
The Generic Address Structure permits QWord access units and the CPPC
accessors implement 64-bit MMIO reads and writes. Use GENMASK_ULL() in both
directions so the mask matches the value and supported access width on
every architecture.
Fixes: 60949b7b8054 ("ACPI: CPPC: Fix MASK_VAL() usage")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/patchset/20260724134251.1632824-1-christian.loehle%40arm.com
Signed-off-by: Christian Loehle <christian.loehle@arm.com>
---
drivers/acpi/cppc_acpi.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
index 925be772041c..9ddcce7dc1a9 100644
--- a/drivers/acpi/cppc_acpi.c
+++ b/drivers/acpi/cppc_acpi.c
@@ -248,10 +248,10 @@ static bool cpc_pcc_write_supported(const struct cpc_register_resource *reg)
/* Shift and apply the mask for CPC reads/writes */
#define MASK_VAL_READ(reg, val) (((val) >> (reg)->bit_offset) & \
- GENMASK(((reg)->bit_width) - 1, 0))
+ GENMASK_ULL(((reg)->bit_width) - 1, 0))
#define MASK_VAL_WRITE(reg, prev_val, val) \
- ((((val) & GENMASK(((reg)->bit_width) - 1, 0)) << (reg)->bit_offset) | \
- ((prev_val) & ~(GENMASK(((reg)->bit_width) - 1, 0) << (reg)->bit_offset))) \
+ ((((val) & GENMASK_ULL(((reg)->bit_width) - 1, 0)) << (reg)->bit_offset) | \
+ ((prev_val) & ~(GENMASK_ULL(((reg)->bit_width) - 1, 0) << (reg)->bit_offset))) \
static u64 cpc_sysmem_access_size(const struct cpc_register_resource *reg)
{
--
2.34.1
next prev parent reply other threads:[~2026-08-30 11:57 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-30 11:56 [PATCH v6 0/15] ACPI: CPPC: Fix register access and lifetime bugs Christian Loehle
2026-08-30 11:56 ` [PATCH v6 01/15] ACPI: CPPC: Validate the _CPC package header Christian Loehle
2026-08-30 11:56 ` [PATCH v6 02/15] ACPI: CPPC: Validate _CPC entry and control semantics Christian Loehle
2026-08-30 13:32 ` Christian Loehle
2026-09-03 19:27 ` Rafael J. Wysocki (Intel)
2026-09-03 19:44 ` Rafael J. Wysocki (Intel)
2026-09-03 20:02 ` Christian Loehle
2026-09-04 16:57 ` Rafael J. Wysocki (Intel)
2026-08-30 11:56 ` [PATCH v6 03/15] ACPI: CPPC: Propagate performance-control write errors Christian Loehle
2026-08-30 11:56 ` Christian Loehle [this message]
2026-08-30 11:56 ` [PATCH v6 05/15] ACPI: CPPC: Serialize PCC single-register payload updates Christian Loehle
2026-08-30 11:56 ` [PATCH v6 06/15] ACPI: CPPC: Serialize PCC EPP " Christian Loehle
2026-08-30 11:56 ` [PATCH v6 07/15] ACPI: CPPC: Release CPC descriptors through kobject Christian Loehle
2026-08-30 11:56 ` [PATCH v6 08/15] ACPI: CPPC: Release PCC data after probe failures Christian Loehle
2026-08-30 11:56 ` [PATCH v6 09/15] ACPI: CPPC: Reject unsafe cross-CPU SystemMemory RMW Christian Loehle
2026-08-30 11:56 ` [PATCH v6 10/15] ACPI: CPPC: Reject direct reads of write-only controls Christian Loehle
2026-08-30 11:56 ` [PATCH v6 11/15] ACPI: CPPC: Validate and access PCC register layouts Christian Loehle
2026-08-30 11:56 ` [PATCH v6 12/15] ACPI: CPPC: Validate SystemIO " Christian Loehle
2026-08-30 11:56 ` [PATCH v6 13/15] ACPI: CPPC: Validate PCC overlaps across processors Christian Loehle
2026-08-30 11:56 ` [PATCH v6 14/15] ACPI: CPPC: Validate SystemIO " Christian Loehle
2026-08-30 11:56 ` [PATCH v6 15/15] ACPI: CPPC: Clear Performance Limited without a stale read Christian Loehle
2026-09-01 6:24 ` [PATCH v6 0/15] ACPI: CPPC: Fix register access and lifetime bugs Christian Loehle
2026-09-01 20:10 ` Mario Limonciello
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=20260830115644.2056983-5-christian.loehle@arm.com \
--to=christian.loehle@arm.com \
--cc=ionela.voinescu@arm.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=pierre.gondois@arm.com \
--cc=rafael@kernel.org \
--cc=sashiko-bot@kernel.org \
--cc=sudeep.holla@arm.com \
--cc=sumitg@nvidia.com \
--cc=viresh.kumar@linaro.org \
--cc=zhanjie9@hisilicon.com \
--cc=zhenglifeng1@huawei.com \
--cc=zhongqiu.han@oss.qualcomm.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