Re: [PATCH 3/3] remoteproc: zynqmp: release mailbox channels on shutdown

Shah, Tanmay
2026-03-11T19:28:28Z

On 3/11/2026 12:12 PM, Mathieu Poirier wrote:
> On Tue, Mar 10, 2026 at 11:04:54AM -0500, Shah, Tanmay wrote:
>>
>>
>> On 3/10/2026 10:29 AM, Mathieu Poirier wrote:
>>> On Tue, Mar 03, 2026 at 03:51:28PM -0800, Tanmay Shah wrote:
>>>> mailbox driver can't introduce shutdown callback, as it might endup
>>>> closing mbox channels prematurely. By allowing the client driver to
>>>> manage the shutdown process, it's ensured that mailbox channels are
>>>> closed only when they are no longer needed.
>>>>
>>>> Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
>>>> ---
>>>> drivers/remoteproc/xlnx_r5_remoteproc.c | 2 ++
>>>> 1 file changed, 2 insertions(+)
>>>>
>>>> diff --git a/drivers/remoteproc/xlnx_r5_remoteproc.c b/drivers/remoteproc/xlnx_r5_remoteproc.c
>>>> index 5e92dc51f1c0..50a9974f3202 100644
>>>> --- a/drivers/remoteproc/xlnx_r5_remoteproc.c
>>>> +++ b/drivers/remoteproc/xlnx_r5_remoteproc.c
>>>> @@ -1490,6 +1490,8 @@ static void zynqmp_r5_remoteproc_shutdown(struct platform_device *pdev)
>>>> dev_err(cluster->dev, "failed to %s rproc %d\n",
>>>> rproc_state_str, rproc->index);
>>>> }
>>>> +
>>>> + zynqmp_r5_free_mbox(r5_core->ipi);
>>>
>>> This is already called in zynqmp_r5_cluster_exit(), why doing it here again?
>>>
>>
>> Hi,
>>
>> Thanks for reviews.
>> I think cluster_exit() call is called only during driver unload. Where
>> as shutdown callback is called during power-off commands of linux like
>> reboot or shutdown.
>>
>> That is why I am calling it separately during shutdown() callback.
>
> The problem here is that zynqmp_r5_free_mbox() is called twice. At shutdown
> time all drivers go throuth the normal driver shutdown process where
> platform_driver.shutdown() is called and subsequently device management
> callbacks such as zynqmp_r5_cluster_exit(). The same applies to loading and
> unloading of drivers. Unless there is a corner case I can't see, calling
> zynqmp_r5_free_mbox() twice is not needed.
>

Hi Mathieu,

I tested this patch again. On my platform I don't see
zynqmp_r5_cluster_exit() being called when issuing `reboot` command.

It only calls platform_driver.shutdown() callback.

I think device management APIs are called only during driver remove
callback, and not shutdown sequence.

Thanks,
Tanmay

>>
>> Thanks,
>> Tanmay
>>
>>> I have applied the other two patches in this series.
>>>
>>> Thanks,
>>> Mathieu
>>>
>>>> }
>>>> }
>>>>
>>>> --
>>>> 2.34.1
>>>>
>>