This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 7580bc3ae417eb641b8628b557480248def358c4 Author: wangshaoxin <[email protected]> AuthorDate: Tue Dec 2 16:27:35 2025 +0800 drivers/rptun: call boardctl() from a work queue The peer status is checked from the rptun interrupt. boardctl() runs the reboot notifiers, which may sleep (rpmsg_port_uart waits for its tx to drain), and that asserts in interrupt context. Queue the reset or poweroff on HPWORK instead. Signed-off-by: wangshaoxin <[email protected]> Signed-off-by: Bowen Wang <[email protected]> --- drivers/rptun/rptun.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/rptun/rptun.c b/drivers/rptun/rptun.c index f69a077837d..e0001928f3a 100644 --- a/drivers/rptun/rptun.c +++ b/drivers/rptun/rptun.c @@ -82,6 +82,9 @@ struct rptun_priv_s bool rreset; bool stop; pid_t pid; +#if defined(CONFIG_BOARDCTL_RESET) || defined(CONFIG_BOARDCTL_POWEROFF) + struct work_s work; +#endif }; struct rptun_store_s @@ -899,6 +902,20 @@ static void rptun_set_status(FAR struct rptun_priv_s *priv, rptun_notify(&priv->rproc, RPTUN_NOTIFY_ALL); } +#if defined(CONFIG_BOARDCTL_RESET) || defined(CONFIG_BOARDCTL_POWEROFF) +static void rptun_boardctl_work(FAR void *arg) +{ + if ((unsigned long)arg == BOARDIOC_SOFTRESETCAUSE_POWEROFF) + { + boardctl(BOARDIOC_POWEROFF, 0u); + } + else + { + boardctl(BOARDIOC_RESET, (unsigned long)arg); + } +} +#endif + static void rptun_check_peer_status(FAR struct rptun_priv_s *priv) { uint32_t status; @@ -922,13 +939,15 @@ static void rptun_check_peer_status(FAR struct rptun_priv_s *priv) if (RPTUN_STATUS_CHECK(status, BOARDIOC_SOFTRESETCAUSE_POWEROFF)) { #ifdef CONFIG_BOARDCTL_POWEROFF - boardctl(BOARDIOC_POWEROFF, 0u); + work_queue(HPWORK, &priv->work, rptun_boardctl_work, + (FAR void *)(uintptr_t)BOARDIOC_SOFTRESETCAUSE_POWEROFF, 0); #endif } else { #ifdef CONFIG_BOARDCTL_RESET - boardctl(BOARDIOC_RESET, RPTUN_REASON_GET(status)); + work_queue(HPWORK, &priv->work, rptun_boardctl_work, + (FAR void *)(uintptr_t)RPTUN_REASON_GET(status), 0); #endif } }
