From: Sudeep Holla <sudeep.holla@kernel.org>
To: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Sudeep Holla <sudeep.holla@kernel.org>,
acpica-devel@lists.linux.dev,
"Rafael J . Wysocki" <rafael@kernel.org>,
Saket Dumbre <saket.dumbre@intel.com>
Subject: [PATCH 4/4] ACPI: PCC: Cache OpRegion command timeout
Date: Fri, 17 Jul 2026 09:10:05 +0100 [thread overview]
Message-ID: <20260717081005.470013-5-sudeep.holla@kernel.org> (raw)
In-Reply-To: <20260717081005.470013-1-sudeep.holla@kernel.org>
The PCC OperationRegion handler computes the same command completion
wait timeout each time it sends a command. The timeout is derived from
static channel properties, so compute it once when the PCC channel is
set up and store the millisecond value in the mailbox client timeout
field.
Use the cached timeout when waiting for the OperationRegion command to
complete. This keeps the timeout calculation in one place and avoids
recomputing it for every command.
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
---
drivers/acpi/acpi_pcc.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/drivers/acpi/acpi_pcc.c b/drivers/acpi/acpi_pcc.c
index 57d13b25c1d6..345f233d77cd 100644
--- a/drivers/acpi/acpi_pcc.c
+++ b/drivers/acpi/acpi_pcc.c
@@ -50,10 +50,11 @@ static acpi_status
acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function,
void *handler_context, void **region_context)
{
- struct pcc_data *data;
struct acpi_pcc_info *ctx = handler_context;
struct pcc_mbox_chan *pcc_chan;
+ struct pcc_data *data;
acpi_status ret;
+ u64 usecs_lat;
if (function == ACPI_REGION_DEACTIVATE) {
data = *region_context;
@@ -103,6 +104,16 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function,
goto err_free_channel;
}
+ /*
+ * pcc_chan->latency is just a Nominal value. In reality the remote
+ * processor could be much slower to reply. So add an arbitrary
+ * amount of wait on top of Nominal.
+ */
+ usecs_lat = PCC_CMD_WAIT_RETRIES_NUM * pcc_chan->latency;
+ data->cl.tx_tout = DIV_ROUND_UP_ULL(usecs_lat, 1000);
+ if (!data->cl.tx_tout)
+ data->cl.tx_tout = 1;
+
*region_context = data;
return AE_OK;
@@ -121,7 +132,6 @@ acpi_pcc_address_space_handler(u32 function, acpi_physical_address addr,
{
struct pcc_data *data = region_context;
void __iomem *pcc_opregion;
- u64 usecs_lat;
int ret;
pcc_opregion = data->pcc_chan->shmem + PCC_SIGNATURE_SIZE;
@@ -135,14 +145,8 @@ acpi_pcc_address_space_handler(u32 function, acpi_physical_address addr,
if (ret < 0)
return AE_ERROR;
- /*
- * pcc_chan->latency is just a Nominal value. In reality the remote
- * processor could be much slower to reply. So add an arbitrary
- * amount of wait on top of Nominal.
- */
- usecs_lat = PCC_CMD_WAIT_RETRIES_NUM * data->pcc_chan->latency;
ret = wait_for_completion_timeout(&data->done,
- usecs_to_jiffies(usecs_lat));
+ msecs_to_jiffies(data->cl.tx_tout));
if (ret == 0) {
pr_err("PCC command executed timeout!\n");
return AE_TIME;
--
2.43.0
prev parent reply other threads:[~2026-07-17 8:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-17 8:10 [PATCH 0/4] ACPI/PCC: Correct PCC OperationRegion handling Sudeep Holla
2026-07-17 8:10 ` [PATCH 1/4] ACPICA: Fix PCC OperationRegion command offsets Sudeep Holla
2026-07-17 8:10 ` [PATCH 2/4] ACPI: PCC: Preserve shared memory signature in OpRegion handler Sudeep Holla
2026-07-17 8:10 ` [PATCH 3/4] ACPI: PCC: Free channel on OpRegion deactivation Sudeep Holla
2026-07-17 8:10 ` Sudeep Holla [this message]
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=20260717081005.470013-5-sudeep.holla@kernel.org \
--to=sudeep.holla@kernel.org \
--cc=acpica-devel@lists.linux.dev \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=saket.dumbre@intel.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