Re: [PATCH v30 1/3] mailbox: pcc: Type3 Buffer handles ACK IRQ

Adam Young
2025-10-17T16:08:15Z

This is obsoleted/duplicated by Sudeep's patch.  I am going to rebase on
his patch series.

On 10/16/25 17:02, Adam Young wrote:
> The PCC protocol type 3 requests include a field that indicates that the
> recipient should trigger an interrupt once the message has been read
> from the buffer. The sender uses this interrupt to know that a
> transmission is complete, and it is safe to send additional messages.
>
> Signed-off-by: Adam Young <admiyo@os.amperecomputing.com>
>
> mailbox/pcc extended memory helper functions
> ---
> drivers/mailbox/pcc.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c
> index f6714c233f5a..978a7b674946 100644
> --- a/drivers/mailbox/pcc.c
> +++ b/drivers/mailbox/pcc.c
> @@ -306,6 +306,18 @@ static void pcc_chan_acknowledge(struct pcc_chan_info *pchan)
> pcc_chan_reg_read_modify_write(&pchan->db);
> }
>
> +static bool pcc_last_tx_done(struct mbox_chan *chan)
> +{
> + struct pcc_chan_info *pchan = chan->con_priv;
> + u64 val;
> +
> + pcc_chan_reg_read(&pchan->cmd_complete, &val);
> + if (!val)
> + return false;
> + else
> + return true;
> +}
> +
> /**
> * pcc_mbox_irq - PCC mailbox interrupt handler
> * @irq: interrupt number
> @@ -340,6 +352,14 @@ 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 = false;
> +
> + /**
> + * The remote side sent an ack.
> + */
> + if (pchan->type == ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE &&
> + chan->active_req)
> + mbox_chan_txdone(chan, 0);
> +
> mbox_chan_received_data(chan, NULL);
>
> pcc_chan_acknowledge(pchan);
> @@ -490,6 +510,7 @@ static const struct mbox_chan_ops pcc_chan_ops = {
> .send_data = pcc_send_data,
> .startup = pcc_startup,
> .shutdown = pcc_shutdown,
> + .last_tx_done = pcc_last_tx_done,
> };
>
> /**