From: "lihuisong (C)" <lihuisong@huawei.com>
To: Sudeep Holla <sudeep.holla@kernel.org>,
<linux-acpi@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
Jassi Brar <jassisinghbrar@gmail.com>, <lihuisong@huawei.com>
Subject: Re: [PATCH 1/6] mailbox: pcc: Validate shared memory signature on request
Date: Tue, 30 Jun 2026 17:02:31 +0800 [thread overview]
Message-ID: <53b369fc-6ad0-4b0e-8f0d-e1e4ceec2937@huawei.com> (raw)
In-Reply-To: <20260627-acpi_pcc_signature-v1-1-c1b7268d4fdc@kernel.org>
On 6/28/2026 12:37 AM, Sudeep Holla wrote:
> ACPI defines the PCC shared memory signature as the bitwise OR of
> 0x50434300 and the PCC subspace ID. The signature is located at byte
> offset 0 for the generic, extended and reduced PCC shared memory region
> layouts.
>
> Validate the signature when a client requests a PCC mailbox channel, after
> mapping the shared memory and before binding the mailbox client. This
> keeps PCC shared memory validation in the PCC mailbox controller instead
> of duplicating it in individual clients.
>
> ACPI 6.6 added clarification that the signature is populated by the
> platform and verified by OSPM.
>
> Cc: Jassi Brar <jassisinghbrar@gmail.com>
> Cc: Huisong Li <lihuisong@huawei.com>
> Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
> ---
> drivers/mailbox/pcc.c | 38 +++++++++++++++++++++++++++++++++-----
> 1 file changed, 33 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c
> index 636879ae1db7..6fbc17d41774 100644
> --- a/drivers/mailbox/pcc.c
> +++ b/drivers/mailbox/pcc.c
> @@ -345,6 +345,28 @@ static irqreturn_t pcc_mbox_irq(int irq, void *p)
> return IRQ_HANDLED;
> }
>
> +static int pcc_mbox_validate_signature(struct pcc_mbox_chan *pcc_mchan,
> + int subspace_id)
> +{
> + u32 expected_signature = PCC_SIGNATURE | subspace_id;
> + u32 signature;
> +
> + if (pcc_mchan->shmem_size < sizeof(signature)) {
> + pr_err("PCC subspace %d shared memory is too small\n",
> + subspace_id);
> + return -EINVAL;
> + }
> +
> + signature = ioread32(pcc_mchan->shmem);
> + if (signature != expected_signature) {
> + pr_err("PCC subspace %d has invalid signature: %#x expected %#x\n",
> + subspace_id, signature, expected_signature);
> + return -EINVAL;
> + }
> +
> + return 0;
> +}
> +
If the signature is incorrect, there must be an issue with the PCCT
table reporting.
So how about place this verification in pcc_mbox_probe?
We can mark the channel as unavailable so that other normal channels can
continue to be used.
And the impact is minimal.
> /**
> * pcc_mbox_request_channel - PCC clients call this function to
> * request a pointer to their PCC subspace, from which they
> @@ -381,14 +403,20 @@ pcc_mbox_request_channel(struct mbox_client *cl, int subspace_id)
> if (!pcc_mchan->shmem)
> return ERR_PTR(-ENXIO);
>
> + rc = pcc_mbox_validate_signature(pcc_mchan, subspace_id);
> + if (rc)
> + goto err_unmap_shmem;
> +
> rc = mbox_bind_client(chan, cl);
> - if (rc) {
> - iounmap(pcc_mchan->shmem);
> - pcc_mchan->shmem = NULL;
> - return ERR_PTR(rc);
> - }
> + if (rc)
> + goto err_unmap_shmem;
>
> return pcc_mchan;
> +
> +err_unmap_shmem:
> + iounmap(pcc_mchan->shmem);
> + pcc_mchan->shmem = NULL;
> + return ERR_PTR(rc);
> }
> EXPORT_SYMBOL_GPL(pcc_mbox_request_channel);
>
>
next prev parent reply other threads:[~2026-06-30 9:03 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-27 16:37 [PATCH 0/6] ACPI/PCC: Preserve platform-populated PCC signatures Sudeep Holla
2026-06-27 16:37 ` [PATCH 1/6] mailbox: pcc: Validate shared memory signature on request Sudeep Holla
2026-06-30 9:02 ` lihuisong (C) [this message]
2026-06-30 9:18 ` lihuisong (C)
2026-06-30 10:17 ` Sudeep Holla
2026-06-27 16:37 ` [PATCH 2/6] hwmon: xgene: Stop writing PCC shared memory signature Sudeep Holla
2026-06-29 21:11 ` Guenter Roeck
2026-06-27 16:37 ` [PATCH 3/6] i2c: xgene-slimpro: " Sudeep Holla
2026-06-27 16:37 ` [PATCH 4/6] devfreq: hisi_uncore: Preserve " Sudeep Holla
2026-07-02 10:25 ` Sudeep Holla
2026-07-06 9:15 ` lihuisong (C)
2026-06-27 16:37 ` [PATCH 5/6] soc: hisilicon: kunpeng_hccs: Preserve PCC signatures Sudeep Holla
2026-06-27 16:37 ` [PATCH 6/6] ACPI: PCC: Preserve shared memory signature in OpRegion handler Sudeep Holla
2026-06-30 12:33 ` Rafael J. Wysocki (Intel)
2026-06-30 17:00 ` Sudeep Holla
2026-07-01 10:44 ` Rafael J. Wysocki (Intel)
2026-07-01 13:34 ` Sudeep Holla
2026-07-01 14:13 ` Sudeep Holla
2026-07-01 14:39 ` Rafael J. Wysocki (Intel)
2026-07-02 12:19 ` Sudeep Holla
2026-06-30 9:25 ` [PATCH 0/6] ACPI/PCC: Preserve platform-populated PCC signatures lihuisong (C)
2026-06-30 10:49 ` Sudeep Holla
2026-07-01 7:38 ` lihuisong (C)
2026-07-02 10:21 ` Sudeep Holla
2026-07-06 9:02 ` lihuisong (C)
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=53b369fc-6ad0-4b0e-8f0d-e1e4ceec2937@huawei.com \
--to=lihuisong@huawei.com \
--cc=jassisinghbrar@gmail.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=sudeep.holla@kernel.org \
/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