[PATCH 2/6] mailbox: pcc: Wire up ->last_tx_done() for PCC channels

Sudeep Holla posted 6 patches 3 months, 3 weeks ago
[PATCH 2/6] mailbox: pcc: Wire up ->last_tx_done() for PCC channels
Posted by Sudeep Holla 3 months, 3 weeks ago
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’t rely on interrupts.

Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 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;
 }
 
+static bool pcc_last_tx_done(struct mbox_chan *chan)
+{
+	struct pcc_chan_info *pchan = 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 = {
 	.send_data = pcc_send_data,
 	.startup = pcc_startup,
 	.shutdown = pcc_shutdown,
+	.last_tx_done = pcc_last_tx_done,
 };
 
 /**

-- 
2.34.1

Re: [PATCH 2/6] mailbox: pcc: Wire up ->last_tx_done() for PCC channels
Posted by lihuisong (C) 3 months, 3 weeks ago
在 2025/10/17 3:08, Sudeep Holla 写道:
> 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’t rely on interrupts.
>
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
>   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;
>   }
>   
> +static bool pcc_last_tx_done(struct mbox_chan *chan)
> +{
> +	struct pcc_chan_info *pchan = chan->con_priv;
> +
The last_tx_done() is used on the condition that txdone_poll  is true 
and txdone_irq is false.
So how about add WARN_ON() for this in this API?
> +	return pcc_mbox_cmd_complete_check(pchan);
The pcc_mbox_cmd_complete_check() works on type 3/4.
I'm not sure if we need to add some comments or do some other something 
for this.
> +}
> +
>   /**
>    * 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 = {
>   	.send_data = pcc_send_data,
>   	.startup = pcc_startup,
>   	.shutdown = pcc_shutdown,
> +	.last_tx_done = pcc_last_tx_done,
>   };
>   
>   /**
>
Re: [PATCH 2/6] mailbox: pcc: Wire up ->last_tx_done() for PCC channels
Posted by Adam Young 3 months, 3 weeks ago
Tested-by: Adam Young <admiyo@os.amperecompuing.com>

On 10/16/25 15:08, Sudeep Holla wrote:
> 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’t rely on interrupts.
>
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
>   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;
>   }
>   
> +static bool pcc_last_tx_done(struct mbox_chan *chan)
> +{
> +	struct pcc_chan_info *pchan = 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 = {
>   	.send_data = pcc_send_data,
>   	.startup = pcc_startup,
>   	.shutdown = pcc_shutdown,
> +	.last_tx_done = pcc_last_tx_done,
>   };
>   
>   /**
>
Re: [PATCH 2/6] mailbox: pcc: Wire up ->last_tx_done() for PCC channels
Posted by Adam Young 3 months, 3 weeks ago
Correction.  I need to slow down.

Tested-by: Adam Young <admiyo@os.amperecomputing.com>

On 10/17/25 12:48, Adam Young wrote:
> Tested-by: Adam Young <admiyo@os.amperecompuing.com>
>
> On 10/16/25 15:08, Sudeep Holla wrote:
>> 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’t rely on 
>> interrupts.
>>
>> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
>> ---
>>   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;
>>   }
>>   +static bool pcc_last_tx_done(struct mbox_chan *chan)
>> +{
>> +    struct pcc_chan_info *pchan = 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 = {
>>       .send_data = pcc_send_data,
>>       .startup = pcc_startup,
>>       .shutdown = pcc_shutdown,
>> +    .last_tx_done = pcc_last_tx_done,
>>   };
>>     /**
>>