This is an automated email from the ASF dual-hosted git repository.

GUIDINGLI 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 c9f1af8e6e1 drivers/note: start the rpmsg note server on one CPU in 
BMP mode
c9f1af8e6e1 is described below

commit c9f1af8e6e12f5b4b32ba62810f5b900f5886027
Author: chenzihan1 <[email protected]>
AuthorDate: Tue Jul 28 15:04:27 2026 +0800

    drivers/note: start the rpmsg note server on one CPU in BMP mode
    
    In BMP mode all CPUs run the same image, so noterpmsg_server_init()
    registers the rpmsg note server channel on every CPU, while the server
    should run only on the note aggregation core.
    
    Add DRIVERS_NOTERPMSG_SERVER_CPUID, as SYSLOG_RPMSG_SERVER_CPUID does for
    the syslog server: when set, only that CPU registers the server.
    
    Signed-off-by: chenzihan1 <[email protected]>
---
 drivers/note/Kconfig            | 10 ++++++++++
 drivers/note/noterpmsg_server.c | 11 +++++++++++
 2 files changed, 21 insertions(+)

diff --git a/drivers/note/Kconfig b/drivers/note/Kconfig
index c8294f32e11..4b0e1b318b8 100644
--- a/drivers/note/Kconfig
+++ b/drivers/note/Kconfig
@@ -244,6 +244,16 @@ config DRIVERS_NOTERPMSG_SERVER
        ---help---
                Use rpmsg to receive message from remote proc.
 
+config DRIVERS_NOTERPMSG_SERVER_CPUID
+       int "The cpuid on which the NOTE RPMSG server runs"
+       depends on DRIVERS_NOTERPMSG_SERVER && BMP
+       ---help---
+               In BMP mode all CPUs share the same firmware image, so
+               noterpmsg_server_init() would otherwise register the RPMSG
+               server channel on every CPU. Set this to the cpuid of the note
+               aggregation core to only initialize the server there. Leave
+               unset to keep the legacy behavior (init on every CPU).
+
 config DRIVERS_NOTERPMSG
        bool "Note to RPMSG"
        select DRIVERS_NOTE
diff --git a/drivers/note/noterpmsg_server.c b/drivers/note/noterpmsg_server.c
index 3713620996d..24e5a42edf0 100644
--- a/drivers/note/noterpmsg_server.c
+++ b/drivers/note/noterpmsg_server.c
@@ -24,6 +24,8 @@
  * Included Files
  ****************************************************************************/
 
+#include <sched.h>
+
 #include <nuttx/kmalloc.h>
 #include <nuttx/rpmsg/rpmsg.h>
 #include <nuttx/sched_note.h>
@@ -123,6 +125,15 @@ static void noterpmsg_ns_bind(FAR struct rpmsg_device 
*rdev,
 
 int noterpmsg_server_init(void)
 {
+#ifdef CONFIG_DRIVERS_NOTERPMSG_SERVER_CPUID
+  if (sched_getcpu() != CONFIG_DRIVERS_NOTERPMSG_SERVER_CPUID)
+    {
+      /* Only allow to init on the specified rpmsg server CPU */
+
+      return OK;
+    }
+#endif
+
   return rpmsg_register_callback(NULL,
                                  NULL,
                                  NULL,

Reply via email to