mbox series

[0/4] remoteproc: k3-r5: Introduce suspend to ram support

Message ID 20240621150058.319524-1-richard.genoud@bootlin.com (mailing list archive)
Headers show
Series remoteproc: k3-r5: Introduce suspend to ram support | expand

Message

Richard GENOUD June 21, 2024, 3 p.m. UTC
This series enables the suspend to ram with R5F remote processors on TI K3
platform.

The 1st patch is actually a fix, independent from the others

The 2nd patch introduces the suspend/resume handlers.
On suspend, the running rprocs will be stopped (or detached) and then
re-loaded in resume.
The logic behind this is:
 - shutdown the cores that Linux started to save power in suspend.
 - detach the cores that were started before Linux.

Then, the 3rd and 4th patches introduce the graceful shutdown of remote
procs. This will give them a chance to release resources and shut down
in a civilized manner.

Without this series, the suspend fails with:

omap-mailbox 31f81000.mailbox: fifo 1 has unexpected unread messages
omap-mailbox 31f81000.mailbox: PM: dpm_run_callback(): platform_pm_suspend returns -16
omap-mailbox 31f81000.mailbox: PM: platform_pm_suspend returned -16 after 16328 usecs
omap-mailbox 31f81000.mailbox: PM: failed to suspend: error -16

Patches 2 and 4 are based on work from Hari Nagalla <hnagalla@ti.com>.

@Hari, please feel free to add your Co-developed-by:/Signed-off-by:

Tested on J7200X SoM
Series is based on v6.10-rc4

Richard Genoud (4):
  remoteproc: k3-r5: Fix IPC-only mode detection
  remoteproc: k3-r5: Introduce PM suspend/resume handlers
  remoteproc: k3-r5: k3_r5_rproc_stop: code reorder
  remoteproc: k3-r5: support for graceful stop of remote cores

 drivers/remoteproc/omap_remoteproc.h     |   9 +-
 drivers/remoteproc/ti_k3_r5_remoteproc.c | 196 +++++++++++++++++++++--
 2 files changed, 188 insertions(+), 17 deletions(-)

Comments

Mathieu Poirier June 28, 2024, 9:23 p.m. UTC | #1
On Fri, 21 Jun 2024 at 09:01, Richard Genoud <richard.genoud@bootlin.com> wrote:
>
> This series enables the suspend to ram with R5F remote processors on TI K3
> platform.
>
> The 1st patch is actually a fix, independent from the others
>
> The 2nd patch introduces the suspend/resume handlers.
> On suspend, the running rprocs will be stopped (or detached) and then
> re-loaded in resume.
> The logic behind this is:
>  - shutdown the cores that Linux started to save power in suspend.
>  - detach the cores that were started before Linux.
>
> Then, the 3rd and 4th patches introduce the graceful shutdown of remote
> procs. This will give them a chance to release resources and shut down
> in a civilized manner.
>
> Without this series, the suspend fails with:
>
> omap-mailbox 31f81000.mailbox: fifo 1 has unexpected unread messages
> omap-mailbox 31f81000.mailbox: PM: dpm_run_callback(): platform_pm_suspend returns -16
> omap-mailbox 31f81000.mailbox: PM: platform_pm_suspend returned -16 after 16328 usecs
> omap-mailbox 31f81000.mailbox: PM: failed to suspend: error -16
>
> Patches 2 and 4 are based on work from Hari Nagalla <hnagalla@ti.com>.
>
> @Hari, please feel free to add your Co-developed-by:/Signed-off-by:
>
> Tested on J7200X SoM
> Series is based on v6.10-rc4
>
> Richard Genoud (4):
>   remoteproc: k3-r5: Fix IPC-only mode detection
>   remoteproc: k3-r5: Introduce PM suspend/resume handlers
>   remoteproc: k3-r5: k3_r5_rproc_stop: code reorder
>   remoteproc: k3-r5: support for graceful stop of remote cores
>
>  drivers/remoteproc/omap_remoteproc.h     |   9 +-
>  drivers/remoteproc/ti_k3_r5_remoteproc.c | 196 +++++++++++++++++++++--
>  2 files changed, 188 insertions(+), 17 deletions(-)
>

Nishanth, Vignesh, Hari and Andrew - I will wait for you guys to
review this patch before moving forward.

Thanks,
Mathieu
Hari Nagalla July 1, 2024, 9:59 a.m. UTC | #2
On 6/21/24 10:00, Richard Genoud wrote:
> Richard Genoud (4):
>    remoteproc: k3-r5: Fix IPC-only mode detection
>    remoteproc: k3-r5: Introduce PM suspend/resume handlers
>    remoteproc: k3-r5: k3_r5_rproc_stop: code reorder
>    remoteproc: k3-r5: support for graceful stop of remote cores
IMO, the patches are better reordered as below (since there is a LPM 
rearch in progress)
patch1 - Independent of other patches and is clearly a bug fix.
patch3,4 - Support for graceful shutdown. A separate feature used by 
customers wanting to change FW at runtime and is independent of 
suspend/resume.
patch 2 - suspend/resume handlers..
Richard GENOUD July 8, 2024, 7:33 a.m. UTC | #3
Le 01/07/2024 à 11:59, Hari Nagalla a écrit :
> On 6/21/24 10:00, Richard Genoud wrote:
>> Richard Genoud (4):
>>    remoteproc: k3-r5: Fix IPC-only mode detection
>>    remoteproc: k3-r5: Introduce PM suspend/resume handlers
>>    remoteproc: k3-r5: k3_r5_rproc_stop: code reorder
>>    remoteproc: k3-r5: support for graceful stop of remote cores
> IMO, the patches are better reordered as below (since there is a LPM 
> rearch in progress)
> patch1 - Independent of other patches and is clearly a bug fix.
> patch3,4 - Support for graceful shutdown. A separate feature used by 
> customers wanting to change FW at runtime and is independent of 
> suspend/resume.
> patch 2 - suspend/resume handlers..
> 

Indeed, patches 2, 3, 4 still need some internal discussions.

But I think patch 1 could be taken as is, since it's a bug fix.

Regards,
Richard