Hi Tanmay,

On Wed, Jun 10, 2026 at 11:27:10AM -0700, Tanmay Shah wrote:
> Current attach on recovery mechanism loads the clean resource table
> during recovery, but doesn't re-allocate the resources. RPMsg
> communication will fail after recovery due to this. Fix this
> incorrect behavior by doing the full detach and attach of remote
> processor during the recovery. This will load the clean resource table
> and re-allocate all the resources, which will set up correct vring
> information in the resource table.
> 
> Signed-off-by: Tanmay Shah <[email protected]>
> ---
>  drivers/remoteproc/remoteproc_core.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/remoteproc/remoteproc_core.c 
> b/drivers/remoteproc/remoteproc_core.c
> index f003be006b1b..8393468fa1ee 100644
> --- a/drivers/remoteproc/remoteproc_core.c
> +++ b/drivers/remoteproc/remoteproc_core.c
> @@ -1776,7 +1776,20 @@ static int rproc_attach_recovery(struct rproc *rproc)
>       if (ret)
>               return ret;
>  
> -     return __rproc_attach(rproc);
> +     /* clean up all acquired resources */
> +     rproc_resource_cleanup(rproc);
> +
> +     /* release HW resources if needed */
> +     rproc_unprepare_device(rproc);
> +
> +     rproc_disable_iommu(rproc);
> +
> +     /* Free the copy of the resource table */
> +     kfree(rproc->cached_table);
> +     rproc->cached_table = NULL;
> +     rproc->table_ptr = NULL;
> +
> +     return rproc_attach(rproc);

That part works.

>  }
>  
>  static int rproc_boot_recovery(struct rproc *rproc)
> -- 
> 2.34.1
> 

Reply via email to