This is an automated email from the ASF dual-hosted git repository.
casaroli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new b9dde1d653c arch/arm/src/imx9: rptun: Kick the host via MU general
purpose interrupt 1.
b9dde1d653c is described below
commit b9dde1d653c976a4f207962361607c6638b6bd06
Author: Phil-Engljaehringer <[email protected]>
AuthorDate: Fri Oct 23 11:29:27 2026 +0200
arch/arm/src/imx9: rptun: Kick the host via MU general purpose interrupt 1.
Ring MU general purpose interrupt 1, the doorbell of the host ("rxdb"
mailbox channel of the Linux imx_rproc driver), in
imx9_rptun_get_resource(), right after a fresh resource table has been
copied to the shared memory.
This lets a Linux host that keeps running while the M7 reboots, e.g.
after a firmware update, detect the restart and attach to the fresh
resource table again. A host that does not listen to the doorbell
ignores it.
get_resource is the last driver operation that runs before rptun waits
for the host to set DRIVER_OK in the remote role: ops->start is only
called for the master, and in older rptun versions register_callback
runs only after that wait.
The doorbell is opt-in with the new IMX9_RPTUN_KICK_HOST option, so the
behaviour of existing configurations does not change.
Assisted-by: Claude-Code:claude-opus-5-5
Signed-off-by: Phil-Engljaehringer <[email protected]>
---
arch/arm/src/imx9/Kconfig | 14 ++++++++++++++
arch/arm/src/imx9/imx9_rptun.c | 37 +++++++++++++++++++++++++++++++++++++
2 files changed, 51 insertions(+)
diff --git a/arch/arm/src/imx9/Kconfig b/arch/arm/src/imx9/Kconfig
index bd1ca1f12f7..897dfa913f7 100644
--- a/arch/arm/src/imx9/Kconfig
+++ b/arch/arm/src/imx9/Kconfig
@@ -91,6 +91,20 @@ config IMX9_RPTUN_ALWAYS_COPY_RSC_TABLE
If disabled, the table is only copied when RESOURCE_TABLE_BASE
does not already hold a table.
+config IMX9_RPTUN_KICK_HOST
+ bool "Kick the host on rptun start"
+ default n
+ depends on RPTUN
+ ---help---
+ Ring MU general purpose interrupt 1 after the resource table has
+ been copied to the shared memory, to signal the host that the
core
+ is waiting for it to set up the virtio devices. The Linux
imx_rproc
+ driver receives it on its "rxdb" mailbox channel; a host can
use it
+ to attach again after the core rebooted while the host kept
+ running.
+
+ A host that does not listen to the doorbell ignores it.
+
menu "i.MX9 Peripheral Selection"
config IMX9_EDMA
diff --git a/arch/arm/src/imx9/imx9_rptun.c b/arch/arm/src/imx9/imx9_rptun.c
index 1eb07d219ad..1ba7e33de8a 100644
--- a/arch/arm/src/imx9/imx9_rptun.c
+++ b/arch/arm/src/imx9/imx9_rptun.c
@@ -29,8 +29,10 @@
#include "arm_internal.h"
#include "imx9_mu.h"
#include "imx9_rsctable.h"
+#include "hardware/imx9_mu.h"
#include "hardware/imx9_rptun.h"
#include "hardware/imx9_rsctable.h"
+#include <arch/barriers.h>
#include <nuttx/debug.h>
#include <nuttx/config.h>
#include <nuttx/kthread.h>
@@ -145,8 +147,41 @@ imx9_rptun_get_addrenv(struct rptun_dev_s *dev)
return NULL;
}
+/****************************************************************************
+ * Name: imx9_rptun_kick_host
+ *
+ * Description:
+ * Ring general purpose interrupt 1, the doorbell ("rxdb") of the host,
+ * to tell it that a fresh resource table is in the shared memory and
+ * this core waits for it to set up the virtio devices. No-op without
+ * CONFIG_IMX9_RPTUN_KICK_HOST.
+ *
+ ****************************************************************************/
+
+static void imx9_rptun_kick_host(struct imx9_rptun_dev_s *priv)
+{
+#ifdef CONFIG_IMX9_RPTUN_KICK_HOST
+ /* The table must be complete before the host sees the doorbell.
+ * -ECOMM only means that the previous doorbell is still pending.
+ */
+
+ UP_DSB();
+ imx9_mu_trigger_interrupts(priv->mu, IMX9_MU_GCR_GIR1_FLAG);
+#else
+ UNUSED(priv);
+#endif
+}
+
/****************************************************************************
* Name: imx9_rptun_get_resource
+ *
+ * Description:
+ * Return the resource table in the shared memory, copying a fresh one
+ * there first if needed and then ringing the doorbell of the host, see
+ * imx9_rptun_kick_host(). This is the last driver operation before
+ * rptun waits for the host to set DRIVER_OK, so a host that kept running
+ * while this core restarted can attach to the fresh table again.
+ *
****************************************************************************/
static struct resource_table *
@@ -159,11 +194,13 @@ imx9_rptun_get_resource(struct rptun_dev_s *dev)
#ifdef CONFIG_IMX9_RPTUN_ALWAYS_COPY_RSC_TABLE
imx9_rsctable_copy();
+ imx9_rptun_kick_host(priv);
#else
if (priv->shmem->rsc.rsc_tbl_hdr.offset
!= g_imx9_rsc_table.rsc_tbl_hdr.offset)
{
imx9_rsctable_copy();
+ imx9_rptun_kick_host(priv);
}
#endif