From nobody Mon Feb 9 02:15:18 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8553B22D4FF; Thu, 16 Oct 2025 19:08:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760641734; cv=none; b=kCc5TW4Xq6Myqn59Pwu2JDRIIUygB484OTow+yR54YZdknfsSGszC0GQKZLQNnD6XR2avT+9rQPX0VIWyf2Myoj06S6fLGKRpqabYf/HYzpYNxLjIyYJ+mz1yS2iRa2QYDN77NXTuLbLDS8CXzlHroPYuhWBr2I0gOOoobooEco= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760641734; c=relaxed/simple; bh=uLrYXi2/iyPCwCIDHxtSg6mF7HS4sj9x6MlSArcqM0c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=paCRQyRZML//pr+2QLjN5iLtjIh6dLZo2tsJ4K7EZdEpAF33dfyub64U/U9el9n/b/YQmR592MS351yoC5TGKhVehtv5HCG1Fx0bzdk6iL5nYDToENw8/Q9k6FgfHvvAfre5LeLTgjp6XRWpOAU6hqcP6pqQVJ9HxOTQSbPhoQc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E4E001713; Thu, 16 Oct 2025 12:08:42 -0700 (PDT) Received: from e133711.arm.com (e133711.arm.com [10.1.196.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 837FC3F66E; Thu, 16 Oct 2025 12:08:49 -0700 (PDT) From: Sudeep Holla Date: Thu, 16 Oct 2025 20:08:15 +0100 Subject: [PATCH 1/6] Revert "mailbox/pcc: support mailbox management of the shared buffer" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251016-pcc_mb_updates-v1-1-0fba69616f69@arm.com> References: <20251016-pcc_mb_updates-v1-0-0fba69616f69@arm.com> In-Reply-To: <20251016-pcc_mb_updates-v1-0-0fba69616f69@arm.com> To: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Adam Young , Robbie King , Huisong Li , Jassi Brar , Cristian Marussi X-Mailer: b4 0.14.3 This reverts commit 5378bdf6a611a32500fccf13d14156f219bb0c85. Commit 5378bdf6a611 ("mailbox/pcc: support mailbox management of the shared= buffer") attempted to introduce generic helpers for managing the PCC shared memory, but it largely duplicates functionality already provided by the mailbox core and leaves gaps: 1. TX preparation: The mailbox framework already supports this via ->tx_prepare callback for mailbox clients. The patch adds pcc_write_to_buffer() and expects clients to toggle pchan->chan.manage_wr= ites, but no drivers set manage_writes, so pcc_write_to_buffer() has no users. 2. RX handling: Data reception is already delivered through mbox_chan_received_data() and client ->rx_callback. The patch adds an optional pchan->chan.rx_alloc, which again has no users and duplicates the existing path. 3. Completion handling: While adding last_tx_done is directionally useful, the implementation only covers Type 3/4 and fails to handle the absence of a command_complete register, so it is incomplete for other types. Given the duplication and incomplete coverage, revert this change. Any new requirements should be addressed in focused follow-ups rather than bundling multiple behavioral changes together. Fixes: 5378bdf6a611 ("mailbox/pcc: support mailbox management of the shared= buffer") Signed-off-by: Sudeep Holla Acked-by: lihuisong@huawei.com Tested-by: Adam Young Tested-by: Adam Young --- drivers/mailbox/pcc.c | 102 ++--------------------------------------------= ---- include/acpi/pcc.h | 29 -------------- 2 files changed, 4 insertions(+), 127 deletions(-) diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c index 0a00719b2482..f6714c233f5a 100644 --- a/drivers/mailbox/pcc.c +++ b/drivers/mailbox/pcc.c @@ -306,22 +306,6 @@ static void pcc_chan_acknowledge(struct pcc_chan_info = *pchan) pcc_chan_reg_read_modify_write(&pchan->db); } =20 -static void *write_response(struct pcc_chan_info *pchan) -{ - struct pcc_header pcc_header; - void *buffer; - int data_len; - - memcpy_fromio(&pcc_header, pchan->chan.shmem, - sizeof(pcc_header)); - data_len =3D pcc_header.length - sizeof(u32) + sizeof(struct pcc_header); - - buffer =3D pchan->chan.rx_alloc(pchan->chan.mchan->cl, data_len); - if (buffer !=3D NULL) - memcpy_fromio(buffer, pchan->chan.shmem, data_len); - return buffer; -} - /** * pcc_mbox_irq - PCC mailbox interrupt handler * @irq: interrupt number @@ -333,8 +317,6 @@ static irqreturn_t pcc_mbox_irq(int irq, void *p) { struct pcc_chan_info *pchan; struct mbox_chan *chan =3D p; - struct pcc_header *pcc_header =3D chan->active_req; - void *handle =3D NULL; =20 pchan =3D chan->con_priv; =20 @@ -358,17 +340,7 @@ static irqreturn_t pcc_mbox_irq(int irq, void *p) * required to avoid any possible race in updatation of this flag. */ pchan->chan_in_use =3D false; - - if (pchan->chan.rx_alloc) - handle =3D write_response(pchan); - - if (chan->active_req) { - pcc_header =3D chan->active_req; - if (pcc_header->flags & PCC_CMD_COMPLETION_NOTIFY) - mbox_chan_txdone(chan, 0); - } - - mbox_chan_received_data(chan, handle); + mbox_chan_received_data(chan, NULL); =20 pcc_chan_acknowledge(pchan); =20 @@ -412,24 +384,9 @@ pcc_mbox_request_channel(struct mbox_client *cl, int s= ubspace_id) pcc_mchan =3D &pchan->chan; pcc_mchan->shmem =3D acpi_os_ioremap(pcc_mchan->shmem_base_addr, pcc_mchan->shmem_size); - if (!pcc_mchan->shmem) - goto err; - - pcc_mchan->manage_writes =3D false; - - /* This indicates that the channel is ready to accept messages. - * This needs to happen after the channel has registered - * its callback. There is no access point to do that in - * the mailbox API. That implies that the mailbox client must - * have set the allocate callback function prior to - * sending any messages. - */ - if (pchan->type =3D=3D ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE) - pcc_chan_reg_read_modify_write(&pchan->cmd_update); - - return pcc_mchan; + if (pcc_mchan->shmem) + return pcc_mchan; =20 -err: mbox_free_channel(chan); return ERR_PTR(-ENXIO); } @@ -460,38 +417,8 @@ void pcc_mbox_free_channel(struct pcc_mbox_chan *pchan) } EXPORT_SYMBOL_GPL(pcc_mbox_free_channel); =20 -static int pcc_write_to_buffer(struct mbox_chan *chan, void *data) -{ - struct pcc_chan_info *pchan =3D chan->con_priv; - struct pcc_mbox_chan *pcc_mbox_chan =3D &pchan->chan; - struct pcc_header *pcc_header =3D data; - - if (!pchan->chan.manage_writes) - return 0; - - /* The PCC header length includes the command field - * but not the other values from the header. - */ - int len =3D pcc_header->length - sizeof(u32) + sizeof(struct pcc_header); - u64 val; - - pcc_chan_reg_read(&pchan->cmd_complete, &val); - if (!val) { - pr_info("%s pchan->cmd_complete not set", __func__); - return -1; - } - memcpy_toio(pcc_mbox_chan->shmem, data, len); - return 0; -} - - /** - * pcc_send_data - Called from Mailbox Controller code. If - * pchan->chan.rx_alloc is set, then the command complete - * flag is checked and the data is written to the shared - * buffer io memory. - * - * If pchan->chan.rx_alloc is not set, then it is used + * pcc_send_data - Called from Mailbox Controller code. Used * here only to ring the channel doorbell. The PCC client * specific read/write is done in the client driver in * order to maintain atomicity over PCC channel once @@ -507,37 +434,17 @@ static int pcc_send_data(struct mbox_chan *chan, void= *data) int ret; struct pcc_chan_info *pchan =3D chan->con_priv; =20 - ret =3D pcc_write_to_buffer(chan, data); - if (ret) - return ret; - ret =3D pcc_chan_reg_read_modify_write(&pchan->cmd_update); if (ret) return ret; =20 ret =3D pcc_chan_reg_read_modify_write(&pchan->db); - if (!ret && pchan->plat_irq > 0) pchan->chan_in_use =3D true; =20 return ret; } =20 - -static bool pcc_last_tx_done(struct mbox_chan *chan) -{ - struct pcc_chan_info *pchan =3D chan->con_priv; - u64 val; - - pcc_chan_reg_read(&pchan->cmd_complete, &val); - if (!val) - return false; - else - return true; -} - - - /** * pcc_startup - Called from Mailbox Controller code. Used here * to request the interrupt. @@ -583,7 +490,6 @@ static const struct mbox_chan_ops pcc_chan_ops =3D { .send_data =3D pcc_send_data, .startup =3D pcc_startup, .shutdown =3D pcc_shutdown, - .last_tx_done =3D pcc_last_tx_done, }; =20 /** diff --git a/include/acpi/pcc.h b/include/acpi/pcc.h index 9af3b502f839..840bfc95bae3 100644 --- a/include/acpi/pcc.h +++ b/include/acpi/pcc.h @@ -17,35 +17,6 @@ struct pcc_mbox_chan { u32 latency; u32 max_access_rate; u16 min_turnaround_time; - - /* Set to true to indicate that the mailbox should manage - * writing the dat to the shared buffer. This differs from - * the case where the drivesr are writing to the buffer and - * using send_data only to ring the doorbell. If this flag - * is set, then the void * data parameter of send_data must - * point to a kernel-memory buffer formatted in accordance with - * the PCC specification. - * - * The active buffer management will include reading the - * notify_on_completion flag, and will then - * call mbox_chan_txdone when the acknowledgment interrupt is - * received. - */ - bool manage_writes; - - /* Optional callback that allows the driver - * to allocate the memory used for receiving - * messages. The return value is the location - * inside the buffer where the mailbox should write the data. - */ - void *(*rx_alloc)(struct mbox_client *cl, int size); -}; - -struct pcc_header { - u32 signature; - u32 flags; - u32 length; - u32 command; }; =20 /* Generic Communications Channel Shared Memory Region */ --=20 2.34.1 From nobody Mon Feb 9 02:15:18 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1E61523D7DF; Thu, 16 Oct 2025 19:08:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760641735; cv=none; b=sKHvwnI8l2qs/poR5YaKA7qk/dsnXznaTesVUEYzRR5zDymfPJkpJOIV0z+F+RsoQW37XYZzjfXPSoLLd8fAjtJl709JbHlsDpZMmIkgCgY7vo1XIS6X2e5ZiU21HtNaKggJRNdRhWWXwEZLeDAjiMPAhX8pPuPeKR2pp+SL+vo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760641735; c=relaxed/simple; bh=V8rB88qtXmWHi5vXK1iHgPh/KZXkQFJee0Jir6Tkfxk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sKpN1t7wKpJRcxJ4kCjjhQfxoKWrjMZJLhYk2ucOYbV7stNuRUf108FWiU7uWfrdMkqvo4QRx79ei0SWXY0pSBpXVL7EnpMg2YrmEUrEOxSDNEaRIXS7Icm9OSbcsY9428MRjn+o4s4aifvbmftzjQsBj2NoO7pgWPPK0j0wRaI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8595426B9; Thu, 16 Oct 2025 12:08:44 -0700 (PDT) Received: from e133711.arm.com (e133711.arm.com [10.1.196.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 26B6A3F66E; Thu, 16 Oct 2025 12:08:51 -0700 (PDT) From: Sudeep Holla Date: Thu, 16 Oct 2025 20:08:16 +0100 Subject: [PATCH 2/6] mailbox: pcc: Wire up ->last_tx_done() for PCC channels Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251016-pcc_mb_updates-v1-2-0fba69616f69@arm.com> References: <20251016-pcc_mb_updates-v1-0-0fba69616f69@arm.com> In-Reply-To: <20251016-pcc_mb_updates-v1-0-0fba69616f69@arm.com> To: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Adam Young , Robbie King , Huisong Li , Jassi Brar , Cristian Marussi X-Mailer: b4 0.14.3 Some PCC users poll for completion between transfers and benefit from the knowledge of previous Tx completion check through the mailbox framework's ->last_tx_done() op. Hook up the last_tx_done callback in the PCC mailbox driver so the mailbox framework can correctly query the completion status of the last transmitted message. This aligns PCC with other controllers that already implement such last_tx_done status query. No functional change unless callers use ->last_tx_done(). Normal Tx and IRQ paths are unchanged. This change just improves synchronization and avoids unnecessary timeouts for non-interrupt driven channels by ensuring correct completion detection for PCC channels that don=E2=80=99t rely on in= terrupts. Signed-off-by: Sudeep Holla Tested-by: Adam Young Tested-by: Adam Young Tested-by: Adam Young --- drivers/mailbox/pcc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c index f6714c233f5a..2b690c268cf0 100644 --- a/drivers/mailbox/pcc.c +++ b/drivers/mailbox/pcc.c @@ -445,6 +445,13 @@ static int pcc_send_data(struct mbox_chan *chan, void = *data) return ret; } =20 +static bool pcc_last_tx_done(struct mbox_chan *chan) +{ + struct pcc_chan_info *pchan =3D chan->con_priv; + + return pcc_mbox_cmd_complete_check(pchan); +} + /** * pcc_startup - Called from Mailbox Controller code. Used here * to request the interrupt. @@ -490,6 +497,7 @@ static const struct mbox_chan_ops pcc_chan_ops =3D { .send_data =3D pcc_send_data, .startup =3D pcc_startup, .shutdown =3D pcc_shutdown, + .last_tx_done =3D pcc_last_tx_done, }; =20 /** --=20 2.34.1 From nobody Mon Feb 9 02:15:18 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B2BF42405E1; Thu, 16 Oct 2025 19:08:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760641736; cv=none; b=GooTDw60VNuUU4zFBxITkLRaEZDPAXyyxnNL/b7Azs6jqdcd5qg0h7h09/N+pFdHDPsw5JmheQ5JOpewYVu2igLXdMLuD+9Jm4Tl1wa/g3kN0EiH3p3OR0Sjxt7aBluS7vvKA6MMYkq6oksXhVILjnq6gYFVzd8qbD0W6rBVH9o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760641736; c=relaxed/simple; bh=PpaQ7BCEXv9Ro94oij7wAw/f4BpfXUSkCtsNnzFifvM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=t62w4zpOvB0V+ae5NEw+Yqv9olnUj0SR1154Uy22GKPdXmfGKY9cO/3fXrCDggfSHxED/yc1I0Q9Ex/NDcFen70ZrOx51uC9cUfuuwKp1WDvhZcrtgK1uam7JkOmKh4dlpr4MDd4SluVfq6VPocQap1LjMHFBU50wVMRQXyBuj4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2BD4426BA; Thu, 16 Oct 2025 12:08:46 -0700 (PDT) Received: from e133711.arm.com (e133711.arm.com [10.1.196.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BEAC03F66E; Thu, 16 Oct 2025 12:08:52 -0700 (PDT) From: Sudeep Holla Date: Thu, 16 Oct 2025 20:08:17 +0100 Subject: [PATCH 3/6] mailbox: pcc: Set txdone_irq/txdone_poll based on PCCT flags Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251016-pcc_mb_updates-v1-3-0fba69616f69@arm.com> References: <20251016-pcc_mb_updates-v1-0-0fba69616f69@arm.com> In-Reply-To: <20251016-pcc_mb_updates-v1-0-0fba69616f69@arm.com> To: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Adam Young , Robbie King , Huisong Li , Jassi Brar , Cristian Marussi X-Mailer: b4 0.14.3 The PCC controller currently enables txdone via IRQ if the PCCT exposes platform capability to generate command completion interrupt, but it leaves txdone_poll unchanged. Make the behaviour explicit: - If ACPI_PCCT_DOORBELL is present, use txdone_irq and disable polling. - Otherwise, disable txdone_irq and fall back to txdone_poll. Configure the PCC mailbox to use interrupt-based completion for PCC types that signal completion via IRQ using TXDONE_BY_IRQ, and fall back to polling for others using TXDONE_BY_POLL. This ensures the PCC driver uses the appropriate completion mechanism according to the PCCT table definition and makes the completion mode unambiguous avoiding mixed signalling when the platform lacks a doorbell flag set. Signed-off-by: Sudeep Holla Acked-by: lihuisong@huawei.com Tested-by: Adam Young Tested-by: Adam Young --- drivers/mailbox/pcc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c index 2b690c268cf0..327e022973db 100644 --- a/drivers/mailbox/pcc.c +++ b/drivers/mailbox/pcc.c @@ -791,8 +791,13 @@ static int pcc_mbox_probe(struct platform_device *pdev) (unsigned long) pcct_tbl + sizeof(struct acpi_table_pcct)); =20 acpi_pcct_tbl =3D (struct acpi_table_pcct *) pcct_tbl; - if (acpi_pcct_tbl->flags & ACPI_PCCT_DOORBELL) + if (acpi_pcct_tbl->flags & ACPI_PCCT_DOORBELL) { pcc_mbox_ctrl->txdone_irq =3D true; + pcc_mbox_ctrl->txdone_poll =3D false; + } else { + pcc_mbox_ctrl->txdone_irq =3D false; + pcc_mbox_ctrl->txdone_poll =3D true; + } =20 for (i =3D 0; i < count; i++) { struct pcc_chan_info *pchan =3D chan_info + i; --=20 2.34.1 From nobody Mon Feb 9 02:15:18 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E0DBB24A066; Thu, 16 Oct 2025 19:08:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760641737; cv=none; b=iKIpRyf5M2jOiSFhrHGVZgSgTbTSEOR1XHnr7bTgPpClJvKZOvtCD5l+nTWfCCVSinwAdrIZHQhuiOd96Rszq1ZIW/7bWyjX563gruY2iWIHNB3pedytBGvGAyMIC1hz2QG0I7RO0ng/RBIXfKaixqRuD35C/DxoMINH4kz3kHM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760641737; c=relaxed/simple; bh=nL/7E4Cxx/lpUPRqpCtNNr30pPpkOpZXBsHXhjwAxZ0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lrK5JbwQQwZ/7QeTszJpBPWXcgKLu4e3u+H8Iu0V9V8lkSYgjjRVAgoDkJNpOemOpXMO43ecAWqGrQ4WuW2lmY6//HeXAiFDBZsPG1TUvT9Af9lsv9U3MTyFk0GNkLClaX/HC2EQ7koLl97xlg8jEiqpZsVt9nL/PqUp+aP8Cp4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BFD2A1688; Thu, 16 Oct 2025 12:08:47 -0700 (PDT) Received: from e133711.arm.com (e133711.arm.com [10.1.196.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 620F03F66E; Thu, 16 Oct 2025 12:08:54 -0700 (PDT) From: Sudeep Holla Date: Thu, 16 Oct 2025 20:08:18 +0100 Subject: [PATCH 4/6] mailbox: pcc: Mark Tx as complete in PCC IRQ handler Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251016-pcc_mb_updates-v1-4-0fba69616f69@arm.com> References: <20251016-pcc_mb_updates-v1-0-0fba69616f69@arm.com> In-Reply-To: <20251016-pcc_mb_updates-v1-0-0fba69616f69@arm.com> To: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Adam Young , Robbie King , Huisong Li , Jassi Brar , Cristian Marussi X-Mailer: b4 0.14.3 The PCC IRQ handler clears channel-in-use and notifies clients with mbox_chan_received_data(), but it does not explicitly mark the transmit as complete. In IRQ completion mode this could leave Tx complete waiters hanging or lead to generic timeouts in the mailbox core. Invoke mbox_chan_txdone() in the IRQ path once the platform has acknowledged the transfer so the core can wake any waiters and update state accordingly. Signed-off-by: Sudeep Holla Tested-by: Adam Young Tested-by: Adam Young --- drivers/mailbox/pcc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c index 327e022973db..33bd2d05704b 100644 --- a/drivers/mailbox/pcc.c +++ b/drivers/mailbox/pcc.c @@ -341,6 +341,7 @@ static irqreturn_t pcc_mbox_irq(int irq, void *p) */ pchan->chan_in_use =3D false; mbox_chan_received_data(chan, NULL); + mbox_chan_txdone(chan, 0); =20 pcc_chan_acknowledge(pchan); =20 --=20 2.34.1 From nobody Mon Feb 9 02:15:18 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 801BC2571AA; Thu, 16 Oct 2025 19:08:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760641739; cv=none; b=Lm4ZPw864NERLQ5AZmb6jTG3vFdS2JVzVgQZ3WB86jPF20hMOT4/Umb6p/i3TvubnHRwpRCyE8oKXeH4efC1TM8Rf/P3Nd17IoFq7tW69sXyrf/0QbWAzHC6IwHzyH/i9cxhzC4Ali3LeccVo32LC0EfrTQcFqoreVHkFhGJdYg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760641739; c=relaxed/simple; bh=TcLZBptfMmxPgr+fAZMbOjN+sil3hhOQPsw4F6Xo8zQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hc2mSk52UQ2PRlFIkhPCO9w5zLJXFC/xpIbO0jeQpDqaAo6nHtMReoLOilaoG+XmO9g8VfFd/I937v8zhcsZc5Vd+gNiVBnVvY6hz4eG4vYCMklOdHzPy7DUcd8j+ECT6lOakUE99Tpnly/KsES5faGF1hs2eC6hPO4QzyMlBbw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 631871713; Thu, 16 Oct 2025 12:08:49 -0700 (PDT) Received: from e133711.arm.com (e133711.arm.com [10.1.196.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 04FCE3F66E; Thu, 16 Oct 2025 12:08:55 -0700 (PDT) From: Sudeep Holla Date: Thu, 16 Oct 2025 20:08:19 +0100 Subject: [PATCH 5/6] mailbox: pcc: Initialize SHMEM before binding the channel with the client Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251016-pcc_mb_updates-v1-5-0fba69616f69@arm.com> References: <20251016-pcc_mb_updates-v1-0-0fba69616f69@arm.com> In-Reply-To: <20251016-pcc_mb_updates-v1-0-0fba69616f69@arm.com> To: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Adam Young , Robbie King , Huisong Li , Jassi Brar , Cristian Marussi X-Mailer: b4 0.14.3 The PCC channel's shared memory region must be set up before the mailbox controller binds the channel with the client, as the binding process may trigger client operations like startup() that may rely on SHMEM being initialized. Reorder the setup sequence to ensure the shared memory is ready before binding. Initialize and map the PCC shared memory (SHMEM) prior to calling mbox_bind_client() so that clients never observe an uninitialized or NULL SHMEM during bind-time callbacks or early use in startup(). This makes the PCC mailbox channel bring-up order consistent and eliminates a race between SHMEM setup and client binding. This will be needed in channel startup to clear/acknowledge any pending interrupts before enabling them. Signed-off-by: Sudeep Holla Acked-by: lihuisong@huawei.com Tested-by: Adam Young Tested-by: Adam Young --- drivers/mailbox/pcc.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c index 33bd2d05704b..2829ec51b47f 100644 --- a/drivers/mailbox/pcc.c +++ b/drivers/mailbox/pcc.c @@ -378,18 +378,20 @@ pcc_mbox_request_channel(struct mbox_client *cl, int = subspace_id) return ERR_PTR(-EBUSY); } =20 - rc =3D mbox_bind_client(chan, cl); - if (rc) - return ERR_PTR(rc); - pcc_mchan =3D &pchan->chan; pcc_mchan->shmem =3D acpi_os_ioremap(pcc_mchan->shmem_base_addr, pcc_mchan->shmem_size); - if (pcc_mchan->shmem) - return pcc_mchan; + if (!pcc_mchan->shmem) + return ERR_PTR(-ENXIO); =20 - mbox_free_channel(chan); - return ERR_PTR(-ENXIO); + rc =3D mbox_bind_client(chan, cl); + if (rc) { + iounmap(pcc_mchan->shmem); + pcc_mchan->shmem =3D NULL; + return ERR_PTR(rc); + } + + return pcc_mchan; } EXPORT_SYMBOL_GPL(pcc_mbox_request_channel); =20 --=20 2.34.1 From nobody Mon Feb 9 02:15:18 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D8080259C98; Thu, 16 Oct 2025 19:08:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760641741; cv=none; b=ktyUMbD2UysV1Svo80KK3dkaebC8HH7PeGKwe5/ceyt5zXK7k5hOy8em84HfyxhDh6NsULwGyyQdbUEojCP8rU54UhkScA+PWBQAxLEFzxtzXFXQCo1j9gy3pvCl3uP1fh+XCEwg5FKNPraXl1qfrCIMwBGf2amga3XzDkJ8Y4A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760641741; c=relaxed/simple; bh=dOv0g/v/VcgHcJpr0BlvqBBGDuuxrQvMLLl9DuYFz58=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DefEVA+qyZ6dvkPFyM+RJzSnvz7CfEuH9gCZqbI7A8Ka9eLztN2V1dCyhAlBx4kgsgPF0Z5DwxabCR7Ujy1tjemiM/biziDTfzMSP8FgxyZ0qbPgg2HJxF73+7NeeHxXTAVVkP0aZ3HnfORz5iRzJWfnihpwPVVQ4vmKXqPmrbc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 05F8126BA; Thu, 16 Oct 2025 12:08:51 -0700 (PDT) Received: from e133711.arm.com (e133711.arm.com [10.1.196.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9C3193F66E; Thu, 16 Oct 2025 12:08:57 -0700 (PDT) From: Sudeep Holla Date: Thu, 16 Oct 2025 20:08:20 +0100 Subject: [PATCH 6/6] mailbox: pcc: Clear any pending responder interrupts before enabling it Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251016-pcc_mb_updates-v1-6-0fba69616f69@arm.com> References: <20251016-pcc_mb_updates-v1-0-0fba69616f69@arm.com> In-Reply-To: <20251016-pcc_mb_updates-v1-0-0fba69616f69@arm.com> To: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Adam Young , Robbie King , Huisong Li , Jassi Brar , Cristian Marussi X-Mailer: b4 0.14.3 Some platforms may leave a responder interrupt pending from earlier transactions. If a PCC responder channel has a pending interrupt when the controller starts up, enabling the IRQ line without first clearing the condition can lead to a spurious interrupt which could disrupt other transmissions if the IRQ is shared. Explicitly clear any pending responder interrupt before enabling the IRQ to ensure a clean start. Acknowledge the responder channel via pcc_chan_acknowledge() in startup before requesting/enablement of the IRQ. This ensures a clean baseline for the first transfer/receiption of the notification/response. Signed-off-by: Sudeep Holla Tested-by: Adam Young Tested-by: Adam Young --- drivers/mailbox/pcc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c index 2829ec51b47f..418007020439 100644 --- a/drivers/mailbox/pcc.c +++ b/drivers/mailbox/pcc.c @@ -468,6 +468,12 @@ static int pcc_startup(struct mbox_chan *chan) unsigned long irqflags; int rc; =20 + /* + * Clear and acknowledge any pending interrupts on responder channel + * before enabling the interrupt + */ + pcc_chan_acknowledge(pchan); + if (pchan->plat_irq > 0) { irqflags =3D pcc_chan_plat_irq_can_be_shared(pchan) ? IRQF_SHARED | IRQF_ONESHOT : 0; --=20 2.34.1