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

commit d77461ec46e2164a346a4962650eee43a50a8951
Author: Binh Nguyen <[email protected]>
AuthorDate: Fri Nov 20 12:28:37 2026 +0000

    boards/arm/rzv2h: Add OpenAMP/RPMsg support
    
    Add OpenAMP/RPMsg support for the RZV2H-EVK and RZV2H-RDK.
    
    Signed-off-by: Binh Nguyen <[email protected]>
---
 .../rzv2h/rzv2h-evk/configs/nsh-openamp/defconfig  |  99 +++++++
 boards/arm/rzv2h/rzv2h-evk/include/board.h         |   4 +
 boards/arm/rzv2h/rzv2h-evk/include/rzv2h-rptun.h   |  80 ++++++
 .../arm/rzv2h/rzv2h-evk/scripts/rzv2h-evk_cr8_0.ld |  30 ++
 boards/arm/rzv2h/rzv2h-evk/src/CMakeLists.txt      |   4 +
 boards/arm/rzv2h/rzv2h-evk/src/Makefile            |   3 +
 boards/arm/rzv2h/rzv2h-evk/src/rzv2h-evk.h         |  13 +
 boards/arm/rzv2h/rzv2h-evk/src/rzv2h_bringup.c     |  10 +
 boards/arm/rzv2h/rzv2h-evk/src/rzv2h_rptun.c       | 304 +++++++++++++++++++++
 boards/arm/rzv2h/rzv2h-evk/src/rzv2h_rsctable.c    | 234 ++++++++++++++++
 boards/arm/rzv2h/rzv2h-evk/src/rzv2h_rsctable.h    |  45 +++
 .../rzv2h/rzv2h-rdk/configs/nsh-openamp/defconfig  |  98 +++++++
 boards/arm/rzv2h/rzv2h-rdk/include/board.h         |   4 +
 boards/arm/rzv2h/rzv2h-rdk/include/rzv2h-rptun.h   |  80 ++++++
 .../arm/rzv2h/rzv2h-rdk/scripts/rzv2h-rdk_cr8_0.ld |  30 ++
 boards/arm/rzv2h/rzv2h-rdk/src/CMakeLists.txt      |   4 +
 boards/arm/rzv2h/rzv2h-rdk/src/Makefile            |   3 +
 boards/arm/rzv2h/rzv2h-rdk/src/rzv2h-rdk.h         |  13 +
 boards/arm/rzv2h/rzv2h-rdk/src/rzv2h_bringup.c     |  10 +
 boards/arm/rzv2h/rzv2h-rdk/src/rzv2h_rptun.c       | 304 +++++++++++++++++++++
 boards/arm/rzv2h/rzv2h-rdk/src/rzv2h_rsctable.c    | 234 ++++++++++++++++
 boards/arm/rzv2h/rzv2h-rdk/src/rzv2h_rsctable.h    |  45 +++
 22 files changed, 1651 insertions(+)

diff --git a/boards/arm/rzv2h/rzv2h-evk/configs/nsh-openamp/defconfig 
b/boards/arm/rzv2h/rzv2h-evk/configs/nsh-openamp/defconfig
new file mode 100644
index 00000000000..e8170c6a262
--- /dev/null
+++ b/boards/arm/rzv2h/rzv2h-evk/configs/nsh-openamp/defconfig
@@ -0,0 +1,99 @@
+#
+# This file is autogenerated: PLEASE DO NOT EDIT IT.
+#
+# You can use "make menuconfig" to make any modifications to the installed 
.config file.
+# You can then do "make savedefconfig" to generate a new defconfig file that 
includes your
+# modifications.
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_BOARD="rzv2h-evk"
+CONFIG_ARCH_BOARD_RZV2H_EVK=y
+CONFIG_ARCH_CHIP="rzv2h"
+CONFIG_ARCH_CHIP_RZV2H=y
+CONFIG_ARCH_CHIP_R9A09G057=y
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_INTERRUPTSTACK=2048
+CONFIG_ARMV7R_DCACHE_DISABLE=y
+CONFIG_ARMV7R_ICACHE_DISABLE=y
+CONFIG_ARCH_LOWVECTORS=y
+CONFIG_BINFMT_DISABLE=y
+CONFIG_ARM_THUMB=y
+CONFIG_BOARD_LOOPSPERMSEC=200000
+CONFIG_BUILTIN=y
+CONFIG_DEV_GPIO=y
+CONFIG_EXAMPLES_GPIO=y
+CONFIG_FS_PROCFS=y
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_INIT_ENTRYPOINT="nsh_main"
+CONFIG_INTELHEX_BINARY=y
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_READLINE=y
+CONFIG_RAM_SIZE=524288
+CONFIG_RAM_START=0x08180000
+CONFIG_START_DAY=29
+CONFIG_START_MONTH=7
+CONFIG_START_YEAR=2026
+CONFIG_SYSTEM_NSH=y
+CONFIG_USEC_PER_TICK=1000
+# enable MPU
+CONFIG_ARM_MPU=y
+CONFIG_ARM_MPU_NREGIONS=8
+
+CONFIG_RZV2H_RPTUN=y
+CONFIG_RZV2H_RPTUN_CHANNEL1=y
+CONFIG_RZV2H_RPTUN_ECHO=y
+CONFIG_RPMSG_LOCAL_CPUNAME="cr8-0"
+
+
+# Enable architecture-specific atomic operations
+CONFIG_LIBC_ARCH_ATOMIC=y
+
+# RTOS --> Disable "Stack backtrace"
+CONFIG_UNWINDER_ARM=n
+CONFIG_SCHED_BACKTRACE=n
+# Build setup->Debug option -> frame pointer
+CONFIG_FRAME_POINTER=n
+
+# NSH Library
+CONFIG_NSH_LIBRARY=y
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_UARTDEV="/dev/ttyS0"
+CONFIG_NSH_CONDEV="/dev/ttyS0"
+CONFIG_TTY_SIGINT=y
+CONFIG_TTY_SIGINT_CHAR=0x03
+CONFIG_SIG_DEFAULT=y
+CONFIG_SCHED_WAITPID=y
+
+# Core Specific Configuration
+CONFIG_RZV2H_CORTEXR8_0=y
+CONFIG_RZV2H_UBOOT_IMAGE=y
+
+# Serial Configuration (SCI2 for NSH console)
+CONFIG_SCI2_SERIALDRIVER=y
+CONFIG_RZV2H_SCI_B_UART2=y
+CONFIG_SCI2_SERIAL_CONSOLE=y
+CONFIG_SCI2_RXBUFSIZE=256
+CONFIG_SCI2_TXBUFSIZE=256
+CONFIG_SCI2_BAUD=115200
+CONFIG_SCI2_BITS=8
+CONFIG_SCI2_PARITY=0
+CONFIG_SCI2_2STOP=0
+CONFIG_SERIAL_TIOCGICOUNT=y
+CONFIG_SERIAL_TERMIOS=y
+
+# Console support
+CONFIG_DEV_CONSOLE=y
+CONFIG_SERIAL_CONSOLE=y
+CONFIG_SYSLOG_CONSOLE=y
+
+# Core Specific Configuration
+CONFIG_RZV2H_CORTEXR8_0=y
+
+# FPU Configuration
+CONFIG_ARCH_FPU=y
+CONFIG_ARCH_DPFPU=y
+
+# Enable idle state logging
+# CONFIG_ARCH_IDLE_CUSTOM is not set
+# CONFIG_RZV2H_IDLE_LOG_STATE is not set
diff --git a/boards/arm/rzv2h/rzv2h-evk/include/board.h 
b/boards/arm/rzv2h/rzv2h-evk/include/board.h
index 41e5f92b628..9dfc16a0cf6 100644
--- a/boards/arm/rzv2h/rzv2h-evk/include/board.h
+++ b/boards/arm/rzv2h/rzv2h-evk/include/board.h
@@ -29,6 +29,10 @@
 
 #include <nuttx/config.h>
 
+#ifdef CONFIG_RZV2H_RPTUN
+#  include "rzv2h-rptun.h"
+#endif
+
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/
diff --git a/boards/arm/rzv2h/rzv2h-evk/include/rzv2h-rptun.h 
b/boards/arm/rzv2h/rzv2h-evk/include/rzv2h-rptun.h
new file mode 100644
index 00000000000..365d4747f3e
--- /dev/null
+++ b/boards/arm/rzv2h/rzv2h-evk/include/rzv2h-rptun.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+ * boards/arm/rzv2h/rzv2h-evk/include/rzv2h-rptun.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __BOARDS_ARM_RZV2H_RZV2H_EVK_INCLUDE_RZV2H_RPTUN_H
+#define __BOARDS_ARM_RZV2H_RZV2H_EVK_INCLUDE_RZV2H_RPTUN_H
+
+/* Multi-OS Package v3.3.0 CR8_0 service 0 UIO layout.  This header is also
+ * consumed by the preprocessed linker script, so keep it macro-only.
+ */
+
+/* Multi-OS Package v3.3.0 CR8_0 UIO layout.  Linux physical addresses,
+ * OpenAMP device addresses, and CR8 virtual addresses are identical.
+ */
+
+#define BOARD_RPTUN_RESOURCE_ADDR       0x42f00000
+#define BOARD_RPTUN_RESOURCE_SIZE       0x00001000
+#define BOARD_RPTUN_RESOURCE_ENTRY_SIZE 0x00000070
+#define BOARD_RPTUN_RESOURCE_RPROC_MEM_OFFSET 0x00000018
+#define BOARD_RPTUN_RESOURCE_VDEV_OFFSET 0x0000002c
+#define BOARD_RPTUN_MHU_SHMEM_ADDR      0x42f01000
+#define BOARD_RPTUN_MHU_SHMEM_SIZE      0x00001000
+#define BOARD_RPTUN_MHU_SHMEM_SLOT_SIZE 0x00000008
+#define BOARD_RPTUN_RPMSG_ADDR          0x43000000
+#define BOARD_RPTUN_RPMSG_SIZE          0x00800000
+#define BOARD_RPTUN_RPMSG_MPU_SIZE      0x01000000
+#define BOARD_RPTUN_VRING_ALIGN         0x00000100
+#define BOARD_RPTUN_VRING_NUM           512
+#define BOARD_RPTUN_VDEV_NOTIFYID       0
+#define BOARD_RPTUN_BUFFER_SIZE         0x00300000
+#define BOARD_RPTUN_REMOTE_CPUNAME      "linux"
+#define BOARD_RPTUN_EPT_ADDR            0
+
+#define BOARD_RPTUN_CHANNEL0_VRING0_ADDR 0x43000000
+#define BOARD_RPTUN_CHANNEL0_VRING1_ADDR 0x43050000
+#define BOARD_RPTUN_CHANNEL0_BUFFER_ADDR 0x43200000
+#define BOARD_RPTUN_CHANNEL0_NOTIFYID  0
+#define BOARD_RPTUN_CHANNEL0_EPT_NAME  "rpmsg-service-0"
+
+#define BOARD_RPTUN_CHANNEL1_VRING0_ADDR 0x43100000
+#define BOARD_RPTUN_CHANNEL1_VRING1_ADDR 0x43150000
+#define BOARD_RPTUN_CHANNEL1_BUFFER_ADDR 0x43500000
+#define BOARD_RPTUN_CHANNEL1_NOTIFYID  1
+#define BOARD_RPTUN_CHANNEL1_EPT_NAME  "rpmsg-service-1"
+
+#ifdef CONFIG_RZV2H_RPTUN_CHANNEL1
+#  define BOARD_RPTUN_CHANNEL          1
+#  define BOARD_RPTUN_VRING0_ADDR      BOARD_RPTUN_CHANNEL1_VRING0_ADDR
+#  define BOARD_RPTUN_VRING1_ADDR      BOARD_RPTUN_CHANNEL1_VRING1_ADDR
+#  define BOARD_RPTUN_BUFFER_ADDR      BOARD_RPTUN_CHANNEL1_BUFFER_ADDR
+#  define BOARD_RPTUN_NOTIFYID         BOARD_RPTUN_CHANNEL1_NOTIFYID
+#  define BOARD_RPTUN_EPT_NAME         BOARD_RPTUN_CHANNEL1_EPT_NAME
+#else
+#  define BOARD_RPTUN_CHANNEL          0
+#  define BOARD_RPTUN_VRING0_ADDR      BOARD_RPTUN_CHANNEL0_VRING0_ADDR
+#  define BOARD_RPTUN_VRING1_ADDR      BOARD_RPTUN_CHANNEL0_VRING1_ADDR
+#  define BOARD_RPTUN_BUFFER_ADDR      BOARD_RPTUN_CHANNEL0_BUFFER_ADDR
+#  define BOARD_RPTUN_NOTIFYID         BOARD_RPTUN_CHANNEL0_NOTIFYID
+#  define BOARD_RPTUN_EPT_NAME         BOARD_RPTUN_CHANNEL0_EPT_NAME
+#endif
+
+#endif /* __BOARDS_ARM_RZV2H_RZV2H_EVK_INCLUDE_RZV2H_RPTUN_H */
diff --git a/boards/arm/rzv2h/rzv2h-evk/scripts/rzv2h-evk_cr8_0.ld 
b/boards/arm/rzv2h/rzv2h-evk/scripts/rzv2h-evk_cr8_0.ld
index a67fc45131d..1a7f2d14018 100644
--- a/boards/arm/rzv2h/rzv2h-evk/scripts/rzv2h-evk_cr8_0.ld
+++ b/boards/arm/rzv2h/rzv2h-evk/scripts/rzv2h-evk_cr8_0.ld
@@ -21,6 +21,7 @@
  ****************************************************************************/
 
 #include <nuttx/config.h>
+#include <arch/board/rzv2h-rptun.h>
 
 /*
  * RZ/V2H Cortex-R8_0 linker script for NuttX.
@@ -51,12 +52,24 @@ MEMORY
     ITCM (rwx)     : ORIGIN = 0x00000000, LENGTH = 128K
     DTCM (rwx)     : ORIGIN = 0x00020000, LENGTH = 128K
     RAM  (rwx)     : ORIGIN = 0x08180000, LENGTH = 512K
+#ifdef CONFIG_RZV2H_RPTUN
+    RSCTBL (rw)    : ORIGIN = BOARD_RPTUN_RESOURCE_ADDR,
+                     LENGTH = BOARD_RPTUN_RESOURCE_SIZE
+#endif
 }
 
 OUTPUT_ARCH(arm)
 EXTERN(_vector_start)
 ENTRY(__start)
 
+#ifdef CONFIG_RZV2H_RPTUN
+/* The generated reference MHU_B_NS instance leaves p_shared_memory NULL.
+ * FSP uses this base symbol and adds eight bytes per logical MHU channel.
+ */
+
+PROVIDE(__mhu_shmem_start = BOARD_RPTUN_MHU_SHMEM_ADDR);
+#endif
+
 /* Start of the read-only SRAM part of the image.  Everything from here up to
  * __mpu_code_end (the vector load image, .text, .rodata, .init_section and
  * .ARM.exidx) is covered by one MPU region programmed
@@ -183,6 +196,23 @@ SECTIONS
 
     _eronly = ABSOLUTE(.);
 
+#ifdef CONFIG_RZV2H_RPTUN
+    /* Multi-OS sample maps the resource table directly at 0x42f00000 through
+     * UIO.  Like the Renesas reference linker script, keep the live table
+     * NOLOAD and initialize it from a template during board bring-up.
+     */
+
+    .resource_table (NOLOAD) :
+    {
+        . = ALIGN(8);
+        KEEP(*(.resource_table))
+        . = ALIGN(4);
+    } > RSCTBL
+
+    ASSERT(SIZEOF(.resource_table) <= BOARD_RPTUN_RESOURCE_SIZE,
+           "RZ/V2H resource table exceeds the reserved region")
+#endif
+
     .data :
     {
         _sdata = ABSOLUTE(.);
diff --git a/boards/arm/rzv2h/rzv2h-evk/src/CMakeLists.txt 
b/boards/arm/rzv2h/rzv2h-evk/src/CMakeLists.txt
index 426ba2da1cc..56beb8e047f 100644
--- a/boards/arm/rzv2h/rzv2h-evk/src/CMakeLists.txt
+++ b/boards/arm/rzv2h/rzv2h-evk/src/CMakeLists.txt
@@ -51,6 +51,10 @@ if(CONFIG_RZV2H_QSPI)
   list(APPEND SRCS rzv2h_qspi.c)
 endif()
 
+if(CONFIG_RZV2H_RPTUN)
+  list(APPEND SRCS rzv2h_rptun.c rzv2h_rsctable.c)
+endif()
+
 # Peripheral driver initialization
 
 target_sources(board PRIVATE ${SRCS})
diff --git a/boards/arm/rzv2h/rzv2h-evk/src/Makefile 
b/boards/arm/rzv2h/rzv2h-evk/src/Makefile
index 424d5e1f6e2..d43a0923076 100644
--- a/boards/arm/rzv2h/rzv2h-evk/src/Makefile
+++ b/boards/arm/rzv2h/rzv2h-evk/src/Makefile
@@ -62,6 +62,9 @@ ifeq ($(CONFIG_RZV2H_QSPI),y)
 CSRCS += rzv2h_qspi.c
 endif
 
+ifeq ($(CONFIG_RZV2H_RPTUN),y)
+CSRCS += rzv2h_rptun.c rzv2h_rsctable.c
+endif
 ############################################################################
 # Peripheral driver initialization
 ############################################################################
diff --git a/boards/arm/rzv2h/rzv2h-evk/src/rzv2h-evk.h 
b/boards/arm/rzv2h/rzv2h-evk/src/rzv2h-evk.h
index 4b387bcbd9e..3f36d798446 100644
--- a/boards/arm/rzv2h/rzv2h-evk/src/rzv2h-evk.h
+++ b/boards/arm/rzv2h/rzv2h-evk/src/rzv2h-evk.h
@@ -71,6 +71,19 @@ int rzv2h_bringup(void);
 int rzv2h_gpio_initialize(void);
 #endif
 
+/****************************************************************************
+ * Name: board_rptun_initialize
+ *
+ * Description:
+ *   Register the Cortex-R8 RPTUN device using the board's FSP MHU_B_NS
+ *   instance.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_RZV2H_RPTUN
+int board_rptun_initialize(void);
+#endif
+
 /****************************************************************************
  * Name: board_button_initialize
  *
diff --git a/boards/arm/rzv2h/rzv2h-evk/src/rzv2h_bringup.c 
b/boards/arm/rzv2h/rzv2h-evk/src/rzv2h_bringup.c
index cafd6d40089..e7d86e4d8fa 100644
--- a/boards/arm/rzv2h/rzv2h-evk/src/rzv2h_bringup.c
+++ b/boards/arm/rzv2h/rzv2h-evk/src/rzv2h_bringup.c
@@ -313,6 +313,16 @@ int rzv2h_bringup(void)
     }
 #endif
 
+#ifdef CONFIG_RZV2H_RPTUN
+  ret = board_rptun_initialize();
+  if (ret < 0)
+    {
+      syslog(LOG_ERR, "ERROR: board_rptun_initialize() failed: %d\n",
+             ret);
+      return ret;
+    }
+#endif
+
 #if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER)
   /* Register the user LED driver.  The generic lower half calls
    * board_userled_initialize() before registering /dev/userleds.
diff --git a/boards/arm/rzv2h/rzv2h-evk/src/rzv2h_rptun.c 
b/boards/arm/rzv2h/rzv2h-evk/src/rzv2h_rptun.c
new file mode 100644
index 00000000000..c6142156cc8
--- /dev/null
+++ b/boards/arm/rzv2h/rzv2h-evk/src/rzv2h_rptun.c
@@ -0,0 +1,304 @@
+/****************************************************************************
+ * boards/arm/rzv2h/rzv2h-evk/src/rzv2h_rptun.c
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <string.h>
+#include <errno.h>
+#include <syslog.h>
+#include <sys/types.h>
+
+#include <nuttx/compiler.h>
+#include <nuttx/irq.h>
+#include <nuttx/kthread.h>
+#include <nuttx/rpmsg/rpmsg.h>
+#include <nuttx/rptun/rptun.h>
+#include <arch/board/board.h>
+
+#include "r_mhu_b_ns.h"
+#include "rzv2h_irq_id.h"
+#include "rzv2h_rptun.h"
+#include "rzv2h_rsctable.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define RZV2H_RPTUN_MHU_CHANNEL       3
+#define RZV2H_RPTUN_MHU_IRQ_PRIORITY  12
+#define RZV2H_RPMSG_SHUTDOWN          0xef56a55a
+#define RZV2H_RPTUN_RESTART_STACKSIZE 4096
+
+#if ((1ULL << RZV2H_RPTUN_MHU_CHANNEL) & \
+     BSP_FEATURE_MHU_B_NS_VALID_CHANNEL_MASK) == 0
+#  error RZ/V2H CR8_0 RPMsg MHU channel is not supported by this FSP BSP
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* MHU-B channel and receive IRQ must match the Linux mailbox configuration.
+ * On CR8, receiving a MSG interrupt makes this endpoint the response side of
+ * the MHU-B pair; msgSend() therefore kicks Linux through the paired
+ * response channel.  Keep the message words in the non-cacheable shared MPU
+ * window.
+ */
+
+static mhu_b_ns_instance_ctrl_t g_rzv2h_rptun_mhu_ctrl;
+
+static const mhu_cfg_t g_rzv2h_rptun_mhu_cfg =
+{
+  .channel         = RZV2H_RPTUN_MHU_CHANNEL,
+  .rx_ipl          = RZV2H_RPTUN_MHU_IRQ_PRIORITY,
+  .rx_irq          = RZV2H_IRQ_MHU_MSG3_NS,
+  .p_callback      = NULL,
+  .p_shared_memory = NULL,
+  .p_context       = NULL,
+};
+
+static const mhu_instance_t g_rzv2h_rptun_mhu =
+{
+  .p_ctrl = (mhu_ctrl_t *)&g_rzv2h_rptun_mhu_ctrl,
+  .p_cfg  = &g_rzv2h_rptun_mhu_cfg,
+  .p_api  = &g_mhu_b_ns_on_mhu_b_ns,
+};
+
+static struct rzv2h_rptun_config_s g_rzv2h_rptun_config =
+{
+  .mhu       = &g_rzv2h_rptun_mhu,
+
+  /* FSP pairs the channel 3 MSG receiver with response transmitter 6. */
+
+  .tx_status = &R_MHU_NS6->RSP_INT_STSn,
+  .cpuname   = BOARD_RPTUN_REMOTE_CPUNAME,
+  .notifyid  = BOARD_RPTUN_NOTIFYID,
+};
+
+static bool g_rzv2h_rptun_initialized;
+
+#ifdef CONFIG_RZV2H_RPTUN_ECHO
+static struct rpmsg_endpoint g_rzv2h_echo_ept;
+static bool g_rzv2h_echo_created;
+static bool g_rzv2h_restart_pending;
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+#ifdef CONFIG_RZV2H_RPTUN_ECHO
+
+static int rzv2h_rptun_restart(int argc, FAR char *argv[])
+{
+  irqstate_t flags;
+  int ret;
+
+  (void)argc;
+  (void)argv;
+
+  ret = rptun_poweroff(BOARD_RPTUN_REMOTE_CPUNAME);
+  if (ret >= 0)
+    {
+      rzv2h_rptun_resource_reset();
+      ret = rptun_boot(BOARD_RPTUN_REMOTE_CPUNAME);
+    }
+
+  if (ret < 0)
+    {
+      syslog(LOG_ERR, "ERROR: RZ/V2H RPTUN restart failed: %d\n", ret);
+    }
+  else
+    {
+      syslog(LOG_INFO, "RZ/V2H RPTUN ready for next Linux session\n");
+    }
+
+  flags = enter_critical_section();
+  g_rzv2h_restart_pending = false;
+  leave_critical_section(flags);
+  return ret;
+}
+
+static int rzv2h_echo_ept_cb(FAR struct rpmsg_endpoint *ept,
+                             FAR void *data, size_t len, uint32_t src,
+                             FAR void *priv)
+{
+  uint32_t value;
+  irqstate_t flags;
+  bool restart;
+  int ret;
+
+  (void)src;
+  (void)priv;
+
+  if (len >= sizeof(value))
+    {
+      memcpy(&value, data, sizeof(value));
+      if (value == RZV2H_RPMSG_SHUTDOWN)
+        {
+          syslog(LOG_INFO, "RZ/V2H RPMsg echo: shutdown received\n");
+
+          flags = enter_critical_section();
+          restart = !g_rzv2h_restart_pending;
+          g_rzv2h_restart_pending = true;
+          leave_critical_section(flags);
+
+          if (restart)
+            {
+              ret = kthread_create("rptun-restart",
+                                   SCHED_PRIORITY_DEFAULT,
+                                   RZV2H_RPTUN_RESTART_STACKSIZE,
+                                   rzv2h_rptun_restart, NULL);
+              if (ret < 0)
+                {
+                  flags = enter_critical_section();
+                  g_rzv2h_restart_pending = false;
+                  leave_critical_section(flags);
+                  syslog(LOG_ERR,
+                         "ERROR: RZ/V2H RPTUN restart task failed: %d\n",
+                         ret);
+                }
+            }
+
+          return OK;
+        }
+    }
+
+  ret = rpmsg_send(ept, data, len);
+  if (ret < 0)
+    {
+      syslog(LOG_ERR, "ERROR: RZ/V2H RPMsg echo failed: %d\n", ret);
+      return ret;
+    }
+
+  return OK;
+}
+
+static void rzv2h_echo_device_created(FAR struct rpmsg_device *rdev,
+                                      FAR void *priv)
+{
+  FAR const char *cpuname = rpmsg_get_cpuname(rdev);
+  int ret;
+
+  (void)priv;
+
+  if (g_rzv2h_echo_created || cpuname == NULL ||
+      strcmp(cpuname, BOARD_RPTUN_REMOTE_CPUNAME) != 0)
+    {
+      return;
+    }
+
+  ret = rpmsg_create_ept(&g_rzv2h_echo_ept, rdev,
+                         BOARD_RPTUN_EPT_NAME, BOARD_RPTUN_EPT_ADDR,
+                         RPMSG_ADDR_ANY, rzv2h_echo_ept_cb, NULL);
+  if (ret < 0)
+    {
+      syslog(LOG_ERR, "ERROR: Failed to create %s endpoint: %d\n",
+             BOARD_RPTUN_EPT_NAME, ret);
+      return;
+    }
+
+  g_rzv2h_echo_created = true;
+  syslog(LOG_INFO, "RZ/V2H RPMsg endpoint %s created at address %u\n",
+         BOARD_RPTUN_EPT_NAME, BOARD_RPTUN_EPT_ADDR);
+}
+
+static void rzv2h_echo_device_destroy(FAR struct rpmsg_device *rdev,
+                                      FAR void *priv)
+{
+  (void)priv;
+
+  if (g_rzv2h_echo_created && g_rzv2h_echo_ept.rdev == rdev)
+    {
+      rpmsg_destroy_ept(&g_rzv2h_echo_ept);
+      g_rzv2h_echo_created = false;
+    }
+}
+
+#endif /* CONFIG_RZV2H_RPTUN_ECHO */
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_rptun_initialize
+ ****************************************************************************/
+
+int board_rptun_initialize(void)
+{
+  int ret;
+
+  if (g_rzv2h_rptun_initialized)
+    {
+      return -EALREADY;
+    }
+
+  g_rzv2h_rptun_config.resource =
+    rzv2h_rptun_resource_initialize();
+
+  syslog(LOG_INFO,
+         "RZ/V2H RPTUN: channel=%u rsc=%p "
+         "vrings=%08lx/%08lx buffer=%08lx+%08lx\n",
+         BOARD_RPTUN_CHANNEL,
+         g_rzv2h_rptun_config.resource,
+         (unsigned long)BOARD_RPTUN_VRING0_ADDR,
+         (unsigned long)BOARD_RPTUN_VRING1_ADDR,
+         (unsigned long)BOARD_RPTUN_BUFFER_ADDR,
+         (unsigned long)BOARD_RPTUN_BUFFER_SIZE);
+  syslog(LOG_INFO,
+         "RZ/V2H RPTUN: MHU channel=%lu IRQ=%d shmem=%08lx slot=%08lx\n",
+         (unsigned long)g_rzv2h_rptun_mhu_cfg.channel,
+         g_rzv2h_rptun_mhu_cfg.rx_irq,
+         (unsigned long)BOARD_RPTUN_MHU_SHMEM_ADDR,
+         (unsigned long)(BOARD_RPTUN_MHU_SHMEM_ADDR +
+                         BOARD_RPTUN_MHU_SHMEM_SLOT_SIZE *
+                         RZV2H_RPTUN_MHU_CHANNEL));
+
+#ifdef CONFIG_RZV2H_RPTUN_ECHO
+  ret = rpmsg_register_callback(NULL, rzv2h_echo_device_created,
+                                rzv2h_echo_device_destroy, NULL, NULL);
+  if (ret < 0)
+    {
+      return ret;
+    }
+#endif
+
+  ret = rzv2h_rptun_initialize(&g_rzv2h_rptun_config);
+  if (ret < 0)
+    {
+#ifdef CONFIG_RZV2H_RPTUN_ECHO
+      rpmsg_unregister_callback(NULL, rzv2h_echo_device_created,
+                                rzv2h_echo_device_destroy, NULL, NULL);
+#endif
+      return ret;
+    }
+
+  g_rzv2h_rptun_initialized = true;
+  return OK;
+}
diff --git a/boards/arm/rzv2h/rzv2h-evk/src/rzv2h_rsctable.c 
b/boards/arm/rzv2h/rzv2h-evk/src/rzv2h_rsctable.c
new file mode 100644
index 00000000000..38c2a831842
--- /dev/null
+++ b/boards/arm/rzv2h/rzv2h-evk/src/rzv2h_rsctable.c
@@ -0,0 +1,234 @@
+/****************************************************************************
+ * boards/arm/rzv2h/rzv2h-evk/src/rzv2h_rsctable.c
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+#include <assert.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/compiler.h>
+#include <arch/board/board.h>
+
+#include <openamp/remoteproc.h>
+#include <openamp/rpmsg_virtio.h>
+#include <openamp/virtio.h>
+#include <openamp/virtqueue.h>
+
+#include "rzv2h_rsctable.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define RZV2H_RSC_VERSION          1
+#define RZV2H_RSC_ENTRIES          2
+#define RZV2H_RSC_RPROC_MEM        4
+#define RZV2H_RPMSG_VRINGS         2
+#define RZV2H_RPMSG_FEATURES       ((1U << VIRTIO_RPMSG_F_NS) | \
+                                    VIRTIO_RING_F_MUST_NOTIFY)
+#define RZV2H_RPMSG_CHANNELS       2
+
+/* The Multi-OS v3.3 Linux OpenAMP master reads dfeatures directly and does
+ * not write gfeatures.  Current OpenAMP on the NuttX device side uses the
+ * intersection of both fields.  Initialize both to the common features so
+ * the legacy master and current device agree on name-service support.  The
+ * legacy master also leaves VRING_AVAIL_F_NO_INTERRUPT set while relying on
+ * every remote kick, so VIRTIO_RING_F_MUST_NOTIFY preserves that behavior.
+ */
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/* RSC_RPROC_MEM is a Renesas extension used by the Multi-OS v3.3 host.
+ * Current upstream OpenAMP has no named type for it, but safely ignores
+ * unknown non-vendor entries while still parsing the following RSC_VDEV.
+ */
+
+struct rzv2h_rsc_rproc_mem_s
+{
+  uint32_t type;
+  uint32_t da;
+  uint32_t pa;
+  uint32_t len;
+  uint32_t reserved;
+};
+
+struct rzv2h_resource_table_s
+{
+  uint32_t version;
+  uint32_t num;
+  uint32_t reserved[2];
+  uint32_t offset[RZV2H_RSC_ENTRIES];
+  struct rzv2h_rsc_rproc_mem_s rproc_mem;
+  struct fw_rsc_vdev rpmsg_vdev;
+  struct fw_rsc_vdev_vring rpmsg_vring0;
+  struct fw_rsc_vdev_vring rpmsg_vring1;
+};
+
+static_assert(offsetof(struct rzv2h_resource_table_s, rproc_mem) ==
+              BOARD_RPTUN_RESOURCE_RPROC_MEM_OFFSET,
+              "Renesas resource-table memory-entry offset changed");
+static_assert(offsetof(struct rzv2h_resource_table_s, rpmsg_vdev) ==
+              BOARD_RPTUN_RESOURCE_VDEV_OFFSET,
+              "Renesas resource-table vdev offset changed");
+static_assert(sizeof(struct rzv2h_resource_table_s) ==
+              BOARD_RPTUN_RESOURCE_ENTRY_SIZE,
+              "Renesas resource-table ABI changed");
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static struct rzv2h_resource_table_s
+  g_rzv2h_resources[RZV2H_RPMSG_CHANNELS]
+  locate_data(".resource_table") used_data;
+
+static const struct rzv2h_resource_table_s
+  g_rzv2h_resources_init[RZV2H_RPMSG_CHANNELS] =
+{
+    {
+      .version = RZV2H_RSC_VERSION,
+      .num     = RZV2H_RSC_ENTRIES,
+      .offset  =
+        {
+          offsetof(struct rzv2h_resource_table_s, rproc_mem),
+          offsetof(struct rzv2h_resource_table_s, rpmsg_vdev),
+        },
+      .rproc_mem =
+        {
+          .type = RZV2H_RSC_RPROC_MEM,
+          .da   = BOARD_RPTUN_RPMSG_ADDR,
+          .pa   = BOARD_RPTUN_RPMSG_ADDR,
+          .len  = BOARD_RPTUN_RPMSG_SIZE,
+        },
+      .rpmsg_vdev =
+        {
+          .type          = RSC_VDEV,
+          .id            = VIRTIO_ID_RPMSG,
+          .notifyid      = BOARD_RPTUN_VDEV_NOTIFYID,
+          .dfeatures     = RZV2H_RPMSG_FEATURES,
+          .gfeatures     = RZV2H_RPMSG_FEATURES,
+          .num_of_vrings = RZV2H_RPMSG_VRINGS,
+        },
+      .rpmsg_vring0 =
+        {
+          .da       = BOARD_RPTUN_CHANNEL0_VRING0_ADDR,
+          .align    = BOARD_RPTUN_VRING_ALIGN,
+          .num      = BOARD_RPTUN_VRING_NUM,
+          .notifyid = BOARD_RPTUN_CHANNEL0_NOTIFYID,
+        },
+      .rpmsg_vring1 =
+        {
+          .da       = BOARD_RPTUN_CHANNEL0_VRING1_ADDR,
+          .align    = BOARD_RPTUN_VRING_ALIGN,
+          .num      = BOARD_RPTUN_VRING_NUM,
+          .notifyid = BOARD_RPTUN_CHANNEL0_NOTIFYID,
+        },
+    },
+    {
+      .version = RZV2H_RSC_VERSION,
+      .num     = RZV2H_RSC_ENTRIES,
+      .offset  =
+        {
+          offsetof(struct rzv2h_resource_table_s, rproc_mem),
+          offsetof(struct rzv2h_resource_table_s, rpmsg_vdev),
+        },
+      .rproc_mem =
+        {
+          .type = RZV2H_RSC_RPROC_MEM,
+          .da   = BOARD_RPTUN_RPMSG_ADDR,
+          .pa   = BOARD_RPTUN_RPMSG_ADDR,
+          .len  = BOARD_RPTUN_RPMSG_SIZE,
+        },
+      .rpmsg_vdev =
+        {
+          .type          = RSC_VDEV,
+          .id            = VIRTIO_ID_RPMSG,
+          .notifyid      = BOARD_RPTUN_VDEV_NOTIFYID,
+          .dfeatures     = RZV2H_RPMSG_FEATURES,
+          .gfeatures     = RZV2H_RPMSG_FEATURES,
+          .num_of_vrings = RZV2H_RPMSG_VRINGS,
+        },
+      .rpmsg_vring0 =
+        {
+          .da       = BOARD_RPTUN_CHANNEL1_VRING0_ADDR,
+          .align    = BOARD_RPTUN_VRING_ALIGN,
+          .num      = BOARD_RPTUN_VRING_NUM,
+          .notifyid = BOARD_RPTUN_CHANNEL1_NOTIFYID,
+        },
+      .rpmsg_vring1 =
+        {
+          .da       = BOARD_RPTUN_CHANNEL1_VRING1_ADDR,
+          .align    = BOARD_RPTUN_VRING_ALIGN,
+          .num      = BOARD_RPTUN_VRING_NUM,
+          .notifyid = BOARD_RPTUN_CHANNEL1_NOTIFYID,
+        },
+    },
+};
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: rzv2h_rptun_resource_initialize
+ ****************************************************************************/
+
+FAR struct resource_table *rzv2h_rptun_resource_initialize(void)
+{
+  memcpy(g_rzv2h_resources, g_rzv2h_resources_init,
+         sizeof(g_rzv2h_resources));
+
+  /* The live table is in normal, non-cacheable shared memory.  Complete the
+   * initialization before Linux is allowed to observe VirtIO state there.
+   */
+
+  UP_DSB();
+  return (FAR struct resource_table *)
+         &g_rzv2h_resources[BOARD_RPTUN_CHANNEL];
+}
+
+/****************************************************************************
+ * Name: rzv2h_rptun_resource_reset
+ ****************************************************************************/
+
+void rzv2h_rptun_resource_reset(void)
+{
+  memcpy(&g_rzv2h_resources[BOARD_RPTUN_CHANNEL],
+         &g_rzv2h_resources_init[BOARD_RPTUN_CHANNEL],
+         sizeof(g_rzv2h_resources[BOARD_RPTUN_CHANNEL]));
+
+  /* Linux owns the virtio DRIVER_OK bit.  Clear the completed session and
+   * publish a fresh table so the NuttX RPTUN start thread waits for the next
+   * Linux rpmsg_sample_client instance before recreating its virtqueues.
+   */
+
+  UP_DSB();
+}
diff --git a/boards/arm/rzv2h/rzv2h-evk/src/rzv2h_rsctable.h 
b/boards/arm/rzv2h/rzv2h-evk/src/rzv2h_rsctable.h
new file mode 100644
index 00000000000..608a420d347
--- /dev/null
+++ b/boards/arm/rzv2h/rzv2h-evk/src/rzv2h_rsctable.h
@@ -0,0 +1,45 @@
+/****************************************************************************
+ * boards/arm/rzv2h/rzv2h-evk/src/rzv2h_rsctable.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __BOARDS_ARM_RZV2H_RZV2H_EVK_SRC_RZV2H_RSCTABLE_H
+#define __BOARDS_ARM_RZV2H_RZV2H_EVK_SRC_RZV2H_RSCTABLE_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/compiler.h>
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+struct resource_table;
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+FAR struct resource_table *rzv2h_rptun_resource_initialize(void);
+void rzv2h_rptun_resource_reset(void);
+
+#endif /* __BOARDS_ARM_RZV2H_RZV2H_EVK_SRC_RZV2H_RSCTABLE_H */
diff --git a/boards/arm/rzv2h/rzv2h-rdk/configs/nsh-openamp/defconfig 
b/boards/arm/rzv2h/rzv2h-rdk/configs/nsh-openamp/defconfig
new file mode 100644
index 00000000000..01b0eb7209b
--- /dev/null
+++ b/boards/arm/rzv2h/rzv2h-rdk/configs/nsh-openamp/defconfig
@@ -0,0 +1,98 @@
+#
+# This file is autogenerated: PLEASE DO NOT EDIT IT.
+#
+# You can use "make menuconfig" to make any modifications to the installed 
.config file.
+# You can then do "make savedefconfig" to generate a new defconfig file that 
includes your
+# modifications.
+#
+CONFIG_ARCH="arm"
+CONFIG_ARCH_BOARD="rzv2h-rdk"
+CONFIG_ARCH_BOARD_RZV2H_RDK=y
+CONFIG_ARCH_CHIP="rzv2h"
+CONFIG_ARCH_CHIP_RZV2H=y
+CONFIG_ARCH_CHIP_R9A09G057=y
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_INTERRUPTSTACK=2048
+CONFIG_ARMV7R_DCACHE_DISABLE=y
+CONFIG_ARMV7R_ICACHE_DISABLE=y
+CONFIG_ARCH_LOWVECTORS=y
+CONFIG_BINFMT_DISABLE=y
+CONFIG_ARM_THUMB=y
+CONFIG_BOARD_LOOPSPERMSEC=200000
+CONFIG_BUILTIN=y
+CONFIG_DEV_GPIO=y
+CONFIG_EXAMPLES_GPIO=y
+CONFIG_FS_PROCFS=y
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_INIT_ENTRYPOINT="nsh_main"
+CONFIG_INTELHEX_BINARY=y
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_READLINE=y
+CONFIG_RAM_SIZE=524288
+CONFIG_RAM_START=0x08180000
+CONFIG_START_DAY=29
+CONFIG_START_MONTH=7
+CONFIG_START_YEAR=2026
+CONFIG_SYSTEM_NSH=y
+CONFIG_USEC_PER_TICK=1000
+# enable MPU
+CONFIG_ARM_MPU=y
+CONFIG_ARM_MPU_NREGIONS=8
+
+CONFIG_RZV2H_RPTUN=y
+CONFIG_RZV2H_RPTUN_CHANNEL1=y
+CONFIG_RZV2H_RPTUN_ECHO=y
+CONFIG_RPMSG_LOCAL_CPUNAME="cr8-0"
+
+# Enable architecture-specific atomic operations
+CONFIG_LIBC_ARCH_ATOMIC=y
+
+# RTOS --> Disable "Stack backtrace"
+CONFIG_UNWINDER_ARM=n
+CONFIG_SCHED_BACKTRACE=n
+# Build setup->Debug option -> frame pointer
+CONFIG_FRAME_POINTER=n
+
+# NSH Library
+CONFIG_NSH_LIBRARY=y
+CONFIG_NSH_CONSOLE=y
+CONFIG_NSH_UARTDEV="/dev/ttyS0"
+CONFIG_NSH_CONDEV="/dev/ttyS0"
+CONFIG_TTY_SIGINT=y
+CONFIG_TTY_SIGINT_CHAR=0x03
+CONFIG_SIG_DEFAULT=y
+CONFIG_SCHED_WAITPID=y
+
+# Core Specific Configuration
+CONFIG_RZV2H_CORTEXR8_0=y
+CONFIG_RZV2H_UBOOT_IMAGE=y
+
+# Serial Configuration (SCI0 for NSH console)
+CONFIG_SCI0_SERIALDRIVER=y
+CONFIG_RZV2H_SCI_B_UART0=y
+CONFIG_SCI0_SERIAL_CONSOLE=y
+CONFIG_SCI0_RXBUFSIZE=256
+CONFIG_SCI0_TXBUFSIZE=256
+CONFIG_SCI0_BAUD=115200
+CONFIG_SCI0_BITS=8
+CONFIG_SCI0_PARITY=0
+CONFIG_SCI0_2STOP=0
+CONFIG_SERIAL_TIOCGICOUNT=y
+CONFIG_SERIAL_TERMIOS=y
+
+# Console support
+CONFIG_DEV_CONSOLE=y
+CONFIG_SERIAL_CONSOLE=y
+CONFIG_SYSLOG_CONSOLE=y
+
+# Core Specific Configuration
+CONFIG_RZV2H_CORTEXR8_0=y
+
+# FPU Configuration
+CONFIG_ARCH_FPU=y
+CONFIG_ARCH_DPFPU=y
+
+# Enable idle state logging
+# CONFIG_ARCH_IDLE_CUSTOM is not set
+# CONFIG_RZV2H_IDLE_LOG_STATE is not set
diff --git a/boards/arm/rzv2h/rzv2h-rdk/include/board.h 
b/boards/arm/rzv2h/rzv2h-rdk/include/board.h
index 6088d9a64e1..2de53d74de3 100644
--- a/boards/arm/rzv2h/rzv2h-rdk/include/board.h
+++ b/boards/arm/rzv2h/rzv2h-rdk/include/board.h
@@ -29,6 +29,10 @@
 
 #include <nuttx/config.h>
 
+#ifdef CONFIG_RZV2H_RPTUN
+#  include "rzv2h-rptun.h"
+#endif
+
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/
diff --git a/boards/arm/rzv2h/rzv2h-rdk/include/rzv2h-rptun.h 
b/boards/arm/rzv2h/rzv2h-rdk/include/rzv2h-rptun.h
new file mode 100644
index 00000000000..7f7e545060c
--- /dev/null
+++ b/boards/arm/rzv2h/rzv2h-rdk/include/rzv2h-rptun.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+ * boards/arm/rzv2h/rzv2h-rdk/include/rzv2h-rptun.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __BOARDS_ARM_RZV2H_RZV2H_RDK_INCLUDE_RZV2H_RPTUN_H
+#define __BOARDS_ARM_RZV2H_RZV2H_RDK_INCLUDE_RZV2H_RPTUN_H
+
+/* Multi-OS Package v3.3.0 CR8_0 UIO layout, inherited from the EVK example.
+ * The RDK Linux peer must reserve and expose these same physical ranges and
+ * mailbox channel; the RDK board name alone does not establish that fact.
+ * This header is consumed by the preprocessed linker script, so keep it
+ * macro-only.  OpenAMP device addresses and CR8 virtual addresses are the
+ * same as the Linux physical addresses in this layout.
+ */
+
+#define BOARD_RPTUN_RESOURCE_ADDR       0x42f00000
+#define BOARD_RPTUN_RESOURCE_SIZE       0x00001000
+#define BOARD_RPTUN_RESOURCE_ENTRY_SIZE 0x00000070
+#define BOARD_RPTUN_RESOURCE_RPROC_MEM_OFFSET 0x00000018
+#define BOARD_RPTUN_RESOURCE_VDEV_OFFSET 0x0000002c
+#define BOARD_RPTUN_MHU_SHMEM_ADDR      0x42f01000
+#define BOARD_RPTUN_MHU_SHMEM_SIZE      0x00001000
+#define BOARD_RPTUN_MHU_SHMEM_SLOT_SIZE 0x00000008
+#define BOARD_RPTUN_RPMSG_ADDR          0x43000000
+#define BOARD_RPTUN_RPMSG_SIZE          0x00800000
+#define BOARD_RPTUN_RPMSG_MPU_SIZE      0x01000000
+#define BOARD_RPTUN_VRING_ALIGN         0x00000100
+#define BOARD_RPTUN_VRING_NUM           512
+#define BOARD_RPTUN_VDEV_NOTIFYID       0
+#define BOARD_RPTUN_BUFFER_SIZE         0x00300000
+#define BOARD_RPTUN_REMOTE_CPUNAME      "linux"
+#define BOARD_RPTUN_EPT_ADDR            0
+
+#define BOARD_RPTUN_CHANNEL0_VRING0_ADDR 0x43000000
+#define BOARD_RPTUN_CHANNEL0_VRING1_ADDR 0x43050000
+#define BOARD_RPTUN_CHANNEL0_BUFFER_ADDR 0x43200000
+#define BOARD_RPTUN_CHANNEL0_NOTIFYID  0
+#define BOARD_RPTUN_CHANNEL0_EPT_NAME  "rpmsg-service-0"
+
+#define BOARD_RPTUN_CHANNEL1_VRING0_ADDR 0x43100000
+#define BOARD_RPTUN_CHANNEL1_VRING1_ADDR 0x43150000
+#define BOARD_RPTUN_CHANNEL1_BUFFER_ADDR 0x43500000
+#define BOARD_RPTUN_CHANNEL1_NOTIFYID  1
+#define BOARD_RPTUN_CHANNEL1_EPT_NAME  "rpmsg-service-1"
+
+#ifdef CONFIG_RZV2H_RPTUN_CHANNEL1
+#  define BOARD_RPTUN_CHANNEL          1
+#  define BOARD_RPTUN_VRING0_ADDR      BOARD_RPTUN_CHANNEL1_VRING0_ADDR
+#  define BOARD_RPTUN_VRING1_ADDR      BOARD_RPTUN_CHANNEL1_VRING1_ADDR
+#  define BOARD_RPTUN_BUFFER_ADDR      BOARD_RPTUN_CHANNEL1_BUFFER_ADDR
+#  define BOARD_RPTUN_NOTIFYID         BOARD_RPTUN_CHANNEL1_NOTIFYID
+#  define BOARD_RPTUN_EPT_NAME         BOARD_RPTUN_CHANNEL1_EPT_NAME
+#else
+#  define BOARD_RPTUN_CHANNEL          0
+#  define BOARD_RPTUN_VRING0_ADDR      BOARD_RPTUN_CHANNEL0_VRING0_ADDR
+#  define BOARD_RPTUN_VRING1_ADDR      BOARD_RPTUN_CHANNEL0_VRING1_ADDR
+#  define BOARD_RPTUN_BUFFER_ADDR      BOARD_RPTUN_CHANNEL0_BUFFER_ADDR
+#  define BOARD_RPTUN_NOTIFYID         BOARD_RPTUN_CHANNEL0_NOTIFYID
+#  define BOARD_RPTUN_EPT_NAME         BOARD_RPTUN_CHANNEL0_EPT_NAME
+#endif
+
+#endif /* __BOARDS_ARM_RZV2H_RZV2H_RDK_INCLUDE_RZV2H_RPTUN_H */
diff --git a/boards/arm/rzv2h/rzv2h-rdk/scripts/rzv2h-rdk_cr8_0.ld 
b/boards/arm/rzv2h/rzv2h-rdk/scripts/rzv2h-rdk_cr8_0.ld
index 7647ad51166..3d386991021 100644
--- a/boards/arm/rzv2h/rzv2h-rdk/scripts/rzv2h-rdk_cr8_0.ld
+++ b/boards/arm/rzv2h/rzv2h-rdk/scripts/rzv2h-rdk_cr8_0.ld
@@ -21,6 +21,7 @@
  ****************************************************************************/
 
 #include <nuttx/config.h>
+#include <arch/board/rzv2h-rptun.h>
 
 /*
  * RZ/V2H Cortex-R8_0 linker script for NuttX.
@@ -51,12 +52,24 @@ MEMORY
     ITCM (rwx)     : ORIGIN = 0x00000000, LENGTH = 128K
     DTCM (rwx)     : ORIGIN = 0x00020000, LENGTH = 128K
     RAM  (rwx)     : ORIGIN = 0x08180000, LENGTH = 512K
+#ifdef CONFIG_RZV2H_RPTUN
+    RSCTBL (rw)    : ORIGIN = BOARD_RPTUN_RESOURCE_ADDR,
+                     LENGTH = BOARD_RPTUN_RESOURCE_SIZE
+#endif
 }
 
 OUTPUT_ARCH(arm)
 EXTERN(_vector_start)
 ENTRY(__start)
 
+#ifdef CONFIG_RZV2H_RPTUN
+/* The generated reference MHU_B_NS instance leaves p_shared_memory NULL.
+ * FSP uses this base symbol and adds eight bytes per logical MHU channel.
+ */
+
+PROVIDE(__mhu_shmem_start = BOARD_RPTUN_MHU_SHMEM_ADDR);
+#endif
+
 /* Start of the read-only SRAM part of the image.  Everything from here up to
  * __mpu_code_end (the vector load image, .text, .rodata, .init_section and
  * .ARM.exidx) is covered by one MPU region programmed
@@ -183,6 +196,23 @@ SECTIONS
 
     _eronly = ABSOLUTE(.);
 
+#ifdef CONFIG_RZV2H_RPTUN
+    /* Multi-OS sample maps the resource table directly at 0x42f00000 through
+     * UIO.  Like the Renesas reference linker script, keep the live table
+     * NOLOAD and initialize it from a template during board bring-up.
+     */
+
+    .resource_table (NOLOAD) :
+    {
+        . = ALIGN(8);
+        KEEP(*(.resource_table))
+        . = ALIGN(4);
+    } > RSCTBL
+
+    ASSERT(SIZEOF(.resource_table) <= BOARD_RPTUN_RESOURCE_SIZE,
+           "RZ/V2H resource table exceeds the reserved region")
+#endif
+
     .data :
     {
         _sdata = ABSOLUTE(.);
diff --git a/boards/arm/rzv2h/rzv2h-rdk/src/CMakeLists.txt 
b/boards/arm/rzv2h/rzv2h-rdk/src/CMakeLists.txt
index aa712b59664..058078559e2 100644
--- a/boards/arm/rzv2h/rzv2h-rdk/src/CMakeLists.txt
+++ b/boards/arm/rzv2h/rzv2h-rdk/src/CMakeLists.txt
@@ -51,6 +51,10 @@ if(CONFIG_RZV2H_QSPI)
   list(APPEND SRCS rzv2h_qspi.c)
 endif()
 
+if(CONFIG_RZV2H_RPTUN)
+  list(APPEND SRCS rzv2h_rptun.c rzv2h_rsctable.c)
+endif()
+
 # Peripheral driver initialization
 
 target_sources(board PRIVATE ${SRCS})
diff --git a/boards/arm/rzv2h/rzv2h-rdk/src/Makefile 
b/boards/arm/rzv2h/rzv2h-rdk/src/Makefile
index 8831ca6e8a4..e376cf8b68b 100644
--- a/boards/arm/rzv2h/rzv2h-rdk/src/Makefile
+++ b/boards/arm/rzv2h/rzv2h-rdk/src/Makefile
@@ -62,6 +62,9 @@ ifeq ($(CONFIG_RZV2H_QSPI),y)
 CSRCS += rzv2h_qspi.c
 endif
 
+ifeq ($(CONFIG_RZV2H_RPTUN),y)
+CSRCS += rzv2h_rptun.c rzv2h_rsctable.c
+endif
 ############################################################################
 # Peripheral driver initialization
 ############################################################################
diff --git a/boards/arm/rzv2h/rzv2h-rdk/src/rzv2h-rdk.h 
b/boards/arm/rzv2h/rzv2h-rdk/src/rzv2h-rdk.h
index 26c0c7e4ae2..4bf465ea0e5 100644
--- a/boards/arm/rzv2h/rzv2h-rdk/src/rzv2h-rdk.h
+++ b/boards/arm/rzv2h/rzv2h-rdk/src/rzv2h-rdk.h
@@ -56,6 +56,19 @@
 
 int rzv2h_bringup(void);
 
+/****************************************************************************
+ * Name: board_rptun_initialize
+ *
+ * Description:
+ *   Register the Cortex-R8 RPTUN device using the board's FSP MHU_B_NS
+ *   instance and the Multi-OS shared resource table.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_RZV2H_RPTUN
+int board_rptun_initialize(void);
+#endif
+
 /****************************************************************************
  * Name: rzv2h_gpio_initialize
  *
diff --git a/boards/arm/rzv2h/rzv2h-rdk/src/rzv2h_bringup.c 
b/boards/arm/rzv2h/rzv2h-rdk/src/rzv2h_bringup.c
index 06f124fca55..cc702ce200a 100644
--- a/boards/arm/rzv2h/rzv2h-rdk/src/rzv2h_bringup.c
+++ b/boards/arm/rzv2h/rzv2h-rdk/src/rzv2h_bringup.c
@@ -245,6 +245,16 @@ int rzv2h_bringup(void)
     }
 #endif
 
+#ifdef CONFIG_RZV2H_RPTUN
+  ret = board_rptun_initialize();
+  if (ret < 0)
+    {
+      syslog(LOG_ERR, "ERROR: board_rptun_initialize() failed: %d\n",
+             ret);
+      return ret;
+    }
+#endif
+
 #if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER)
   /* Register the user LED driver.  The generic lower half calls
    * board_userled_initialize() before registering /dev/userleds.
diff --git a/boards/arm/rzv2h/rzv2h-rdk/src/rzv2h_rptun.c 
b/boards/arm/rzv2h/rzv2h-rdk/src/rzv2h_rptun.c
new file mode 100644
index 00000000000..e1c955fde5c
--- /dev/null
+++ b/boards/arm/rzv2h/rzv2h-rdk/src/rzv2h_rptun.c
@@ -0,0 +1,304 @@
+/****************************************************************************
+ * boards/arm/rzv2h/rzv2h-rdk/src/rzv2h_rptun.c
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <string.h>
+#include <errno.h>
+#include <syslog.h>
+#include <sys/types.h>
+
+#include <nuttx/compiler.h>
+#include <nuttx/irq.h>
+#include <nuttx/kthread.h>
+#include <nuttx/rpmsg/rpmsg.h>
+#include <nuttx/rptun/rptun.h>
+#include <arch/board/board.h>
+
+#include "r_mhu_b_ns.h"
+#include "rzv2h_irq_id.h"
+#include "rzv2h_rptun.h"
+#include "rzv2h_rsctable.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define RZV2H_RPTUN_MHU_CHANNEL       3
+#define RZV2H_RPTUN_MHU_IRQ_PRIORITY  12
+#define RZV2H_RPMSG_SHUTDOWN          0xef56a55a
+#define RZV2H_RPTUN_RESTART_STACKSIZE 4096
+
+#if ((1ULL << RZV2H_RPTUN_MHU_CHANNEL) & \
+     BSP_FEATURE_MHU_B_NS_VALID_CHANNEL_MASK) == 0
+#  error RZ/V2H CR8_0 RPMsg MHU channel is not supported by this FSP BSP
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* MHU-B channel and receive IRQ must match the Linux mailbox configuration.
+ * On CR8, receiving a MSG interrupt makes this endpoint the response side of
+ * the MHU-B pair; msgSend() therefore kicks Linux through the paired
+ * response channel.  Keep the message words in the non-cacheable shared MPU
+ * window.
+ */
+
+static mhu_b_ns_instance_ctrl_t g_rzv2h_rptun_mhu_ctrl;
+
+static const mhu_cfg_t g_rzv2h_rptun_mhu_cfg =
+{
+  .channel         = RZV2H_RPTUN_MHU_CHANNEL,
+  .rx_ipl          = RZV2H_RPTUN_MHU_IRQ_PRIORITY,
+  .rx_irq          = RZV2H_IRQ_MHU_MSG3_NS,
+  .p_callback      = NULL,
+  .p_shared_memory = NULL,
+  .p_context       = NULL,
+};
+
+static const mhu_instance_t g_rzv2h_rptun_mhu =
+{
+  .p_ctrl = (mhu_ctrl_t *)&g_rzv2h_rptun_mhu_ctrl,
+  .p_cfg  = &g_rzv2h_rptun_mhu_cfg,
+  .p_api  = &g_mhu_b_ns_on_mhu_b_ns,
+};
+
+static struct rzv2h_rptun_config_s g_rzv2h_rptun_config =
+{
+  .mhu       = &g_rzv2h_rptun_mhu,
+
+  /* FSP pairs the channel 3 MSG receiver with response transmitter 6. */
+
+  .tx_status = &R_MHU_NS6->RSP_INT_STSn,
+  .cpuname   = BOARD_RPTUN_REMOTE_CPUNAME,
+  .notifyid  = BOARD_RPTUN_NOTIFYID,
+};
+
+static bool g_rzv2h_rptun_initialized;
+
+#ifdef CONFIG_RZV2H_RPTUN_ECHO
+static struct rpmsg_endpoint g_rzv2h_echo_ept;
+static bool g_rzv2h_echo_created;
+static bool g_rzv2h_restart_pending;
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+#ifdef CONFIG_RZV2H_RPTUN_ECHO
+
+static int rzv2h_rptun_restart(int argc, FAR char *argv[])
+{
+  irqstate_t flags;
+  int ret;
+
+  (void)argc;
+  (void)argv;
+
+  ret = rptun_poweroff(BOARD_RPTUN_REMOTE_CPUNAME);
+  if (ret >= 0)
+    {
+      rzv2h_rptun_resource_reset();
+      ret = rptun_boot(BOARD_RPTUN_REMOTE_CPUNAME);
+    }
+
+  if (ret < 0)
+    {
+      syslog(LOG_ERR, "ERROR: RZ/V2H RPTUN restart failed: %d\n", ret);
+    }
+  else
+    {
+      syslog(LOG_INFO, "RZ/V2H RPTUN ready for next Linux session\n");
+    }
+
+  flags = enter_critical_section();
+  g_rzv2h_restart_pending = false;
+  leave_critical_section(flags);
+  return ret;
+}
+
+static int rzv2h_echo_ept_cb(FAR struct rpmsg_endpoint *ept,
+                             FAR void *data, size_t len, uint32_t src,
+                             FAR void *priv)
+{
+  uint32_t value;
+  irqstate_t flags;
+  bool restart;
+  int ret;
+
+  (void)src;
+  (void)priv;
+
+  if (len >= sizeof(value))
+    {
+      memcpy(&value, data, sizeof(value));
+      if (value == RZV2H_RPMSG_SHUTDOWN)
+        {
+          syslog(LOG_INFO, "RZ/V2H RPMsg echo: shutdown received\n");
+
+          flags = enter_critical_section();
+          restart = !g_rzv2h_restart_pending;
+          g_rzv2h_restart_pending = true;
+          leave_critical_section(flags);
+
+          if (restart)
+            {
+              ret = kthread_create("rptun-restart",
+                                   SCHED_PRIORITY_DEFAULT,
+                                   RZV2H_RPTUN_RESTART_STACKSIZE,
+                                   rzv2h_rptun_restart, NULL);
+              if (ret < 0)
+                {
+                  flags = enter_critical_section();
+                  g_rzv2h_restart_pending = false;
+                  leave_critical_section(flags);
+                  syslog(LOG_ERR,
+                         "ERROR: RZ/V2H RPTUN restart task failed: %d\n",
+                         ret);
+                }
+            }
+
+          return OK;
+        }
+    }
+
+  ret = rpmsg_send(ept, data, len);
+  if (ret < 0)
+    {
+      syslog(LOG_ERR, "ERROR: RZ/V2H RPMsg echo failed: %d\n", ret);
+      return ret;
+    }
+
+  return OK;
+}
+
+static void rzv2h_echo_device_created(FAR struct rpmsg_device *rdev,
+                                      FAR void *priv)
+{
+  FAR const char *cpuname = rpmsg_get_cpuname(rdev);
+  int ret;
+
+  (void)priv;
+
+  if (g_rzv2h_echo_created || cpuname == NULL ||
+      strcmp(cpuname, BOARD_RPTUN_REMOTE_CPUNAME) != 0)
+    {
+      return;
+    }
+
+  ret = rpmsg_create_ept(&g_rzv2h_echo_ept, rdev,
+                         BOARD_RPTUN_EPT_NAME, BOARD_RPTUN_EPT_ADDR,
+                         RPMSG_ADDR_ANY, rzv2h_echo_ept_cb, NULL);
+  if (ret < 0)
+    {
+      syslog(LOG_ERR, "ERROR: Failed to create %s endpoint: %d\n",
+             BOARD_RPTUN_EPT_NAME, ret);
+      return;
+    }
+
+  g_rzv2h_echo_created = true;
+  syslog(LOG_INFO, "RZ/V2H RPMsg endpoint %s created at address %u\n",
+         BOARD_RPTUN_EPT_NAME, BOARD_RPTUN_EPT_ADDR);
+}
+
+static void rzv2h_echo_device_destroy(FAR struct rpmsg_device *rdev,
+                                      FAR void *priv)
+{
+  (void)priv;
+
+  if (g_rzv2h_echo_created && g_rzv2h_echo_ept.rdev == rdev)
+    {
+      rpmsg_destroy_ept(&g_rzv2h_echo_ept);
+      g_rzv2h_echo_created = false;
+    }
+}
+
+#endif /* CONFIG_RZV2H_RPTUN_ECHO */
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_rptun_initialize
+ ****************************************************************************/
+
+int board_rptun_initialize(void)
+{
+  int ret;
+
+  if (g_rzv2h_rptun_initialized)
+    {
+      return -EALREADY;
+    }
+
+  g_rzv2h_rptun_config.resource =
+    rzv2h_rptun_resource_initialize();
+
+  syslog(LOG_INFO,
+         "RZ/V2H RPTUN: channel=%u rsc=%p "
+         "vrings=%08lx/%08lx buffer=%08lx+%08lx\n",
+         BOARD_RPTUN_CHANNEL,
+         g_rzv2h_rptun_config.resource,
+         (unsigned long)BOARD_RPTUN_VRING0_ADDR,
+         (unsigned long)BOARD_RPTUN_VRING1_ADDR,
+         (unsigned long)BOARD_RPTUN_BUFFER_ADDR,
+         (unsigned long)BOARD_RPTUN_BUFFER_SIZE);
+  syslog(LOG_INFO,
+         "RZ/V2H RPTUN: MHU channel=%lu IRQ=%d shmem=%08lx slot=%08lx\n",
+         (unsigned long)g_rzv2h_rptun_mhu_cfg.channel,
+         g_rzv2h_rptun_mhu_cfg.rx_irq,
+         (unsigned long)BOARD_RPTUN_MHU_SHMEM_ADDR,
+         (unsigned long)(BOARD_RPTUN_MHU_SHMEM_ADDR +
+                         BOARD_RPTUN_MHU_SHMEM_SLOT_SIZE *
+                         RZV2H_RPTUN_MHU_CHANNEL));
+
+#ifdef CONFIG_RZV2H_RPTUN_ECHO
+  ret = rpmsg_register_callback(NULL, rzv2h_echo_device_created,
+                                rzv2h_echo_device_destroy, NULL, NULL);
+  if (ret < 0)
+    {
+      return ret;
+    }
+#endif
+
+  ret = rzv2h_rptun_initialize(&g_rzv2h_rptun_config);
+  if (ret < 0)
+    {
+#ifdef CONFIG_RZV2H_RPTUN_ECHO
+      rpmsg_unregister_callback(NULL, rzv2h_echo_device_created,
+                                rzv2h_echo_device_destroy, NULL, NULL);
+#endif
+      return ret;
+    }
+
+  g_rzv2h_rptun_initialized = true;
+  return OK;
+}
diff --git a/boards/arm/rzv2h/rzv2h-rdk/src/rzv2h_rsctable.c 
b/boards/arm/rzv2h/rzv2h-rdk/src/rzv2h_rsctable.c
new file mode 100644
index 00000000000..dedee8e570f
--- /dev/null
+++ b/boards/arm/rzv2h/rzv2h-rdk/src/rzv2h_rsctable.c
@@ -0,0 +1,234 @@
+/****************************************************************************
+ * boards/arm/rzv2h/rzv2h-rdk/src/rzv2h_rsctable.c
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+#include <assert.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/compiler.h>
+#include <arch/board/board.h>
+
+#include <openamp/remoteproc.h>
+#include <openamp/rpmsg_virtio.h>
+#include <openamp/virtio.h>
+#include <openamp/virtqueue.h>
+
+#include "rzv2h_rsctable.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define RZV2H_RSC_VERSION          1
+#define RZV2H_RSC_ENTRIES          2
+#define RZV2H_RSC_RPROC_MEM        4
+#define RZV2H_RPMSG_VRINGS         2
+#define RZV2H_RPMSG_FEATURES       ((1U << VIRTIO_RPMSG_F_NS) | \
+                                    VIRTIO_RING_F_MUST_NOTIFY)
+#define RZV2H_RPMSG_CHANNELS       2
+
+/* The Multi-OS v3.3 Linux OpenAMP master reads dfeatures directly and does
+ * not write gfeatures.  Current OpenAMP on the NuttX device side uses the
+ * intersection of both fields.  Initialize both to the common features so
+ * the legacy master and current device agree on name-service support.  The
+ * legacy master also leaves VRING_AVAIL_F_NO_INTERRUPT set while relying on
+ * every remote kick, so VIRTIO_RING_F_MUST_NOTIFY preserves that behavior.
+ */
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/* RSC_RPROC_MEM is a Renesas extension used by the Multi-OS v3.3 host.
+ * Current upstream OpenAMP has no named type for it, but safely ignores
+ * unknown non-vendor entries while still parsing the following RSC_VDEV.
+ */
+
+struct rzv2h_rsc_rproc_mem_s
+{
+  uint32_t type;
+  uint32_t da;
+  uint32_t pa;
+  uint32_t len;
+  uint32_t reserved;
+};
+
+struct rzv2h_resource_table_s
+{
+  uint32_t version;
+  uint32_t num;
+  uint32_t reserved[2];
+  uint32_t offset[RZV2H_RSC_ENTRIES];
+  struct rzv2h_rsc_rproc_mem_s rproc_mem;
+  struct fw_rsc_vdev rpmsg_vdev;
+  struct fw_rsc_vdev_vring rpmsg_vring0;
+  struct fw_rsc_vdev_vring rpmsg_vring1;
+};
+
+static_assert(offsetof(struct rzv2h_resource_table_s, rproc_mem) ==
+              BOARD_RPTUN_RESOURCE_RPROC_MEM_OFFSET,
+              "Renesas resource-table memory-entry offset changed");
+static_assert(offsetof(struct rzv2h_resource_table_s, rpmsg_vdev) ==
+              BOARD_RPTUN_RESOURCE_VDEV_OFFSET,
+              "Renesas resource-table vdev offset changed");
+static_assert(sizeof(struct rzv2h_resource_table_s) ==
+              BOARD_RPTUN_RESOURCE_ENTRY_SIZE,
+              "Renesas resource-table ABI changed");
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static struct rzv2h_resource_table_s
+  g_rzv2h_resources[RZV2H_RPMSG_CHANNELS]
+  locate_data(".resource_table") used_data;
+
+static const struct rzv2h_resource_table_s
+  g_rzv2h_resources_init[RZV2H_RPMSG_CHANNELS] =
+{
+    {
+      .version = RZV2H_RSC_VERSION,
+      .num     = RZV2H_RSC_ENTRIES,
+      .offset  =
+        {
+          offsetof(struct rzv2h_resource_table_s, rproc_mem),
+          offsetof(struct rzv2h_resource_table_s, rpmsg_vdev),
+        },
+      .rproc_mem =
+        {
+          .type = RZV2H_RSC_RPROC_MEM,
+          .da   = BOARD_RPTUN_RPMSG_ADDR,
+          .pa   = BOARD_RPTUN_RPMSG_ADDR,
+          .len  = BOARD_RPTUN_RPMSG_SIZE,
+        },
+      .rpmsg_vdev =
+        {
+          .type          = RSC_VDEV,
+          .id            = VIRTIO_ID_RPMSG,
+          .notifyid      = BOARD_RPTUN_VDEV_NOTIFYID,
+          .dfeatures     = RZV2H_RPMSG_FEATURES,
+          .gfeatures     = RZV2H_RPMSG_FEATURES,
+          .num_of_vrings = RZV2H_RPMSG_VRINGS,
+        },
+      .rpmsg_vring0 =
+        {
+          .da       = BOARD_RPTUN_CHANNEL0_VRING0_ADDR,
+          .align    = BOARD_RPTUN_VRING_ALIGN,
+          .num      = BOARD_RPTUN_VRING_NUM,
+          .notifyid = BOARD_RPTUN_CHANNEL0_NOTIFYID,
+        },
+      .rpmsg_vring1 =
+        {
+          .da       = BOARD_RPTUN_CHANNEL0_VRING1_ADDR,
+          .align    = BOARD_RPTUN_VRING_ALIGN,
+          .num      = BOARD_RPTUN_VRING_NUM,
+          .notifyid = BOARD_RPTUN_CHANNEL0_NOTIFYID,
+        },
+    },
+    {
+      .version = RZV2H_RSC_VERSION,
+      .num     = RZV2H_RSC_ENTRIES,
+      .offset  =
+        {
+          offsetof(struct rzv2h_resource_table_s, rproc_mem),
+          offsetof(struct rzv2h_resource_table_s, rpmsg_vdev),
+        },
+      .rproc_mem =
+        {
+          .type = RZV2H_RSC_RPROC_MEM,
+          .da   = BOARD_RPTUN_RPMSG_ADDR,
+          .pa   = BOARD_RPTUN_RPMSG_ADDR,
+          .len  = BOARD_RPTUN_RPMSG_SIZE,
+        },
+      .rpmsg_vdev =
+        {
+          .type          = RSC_VDEV,
+          .id            = VIRTIO_ID_RPMSG,
+          .notifyid      = BOARD_RPTUN_VDEV_NOTIFYID,
+          .dfeatures     = RZV2H_RPMSG_FEATURES,
+          .gfeatures     = RZV2H_RPMSG_FEATURES,
+          .num_of_vrings = RZV2H_RPMSG_VRINGS,
+        },
+      .rpmsg_vring0 =
+        {
+          .da       = BOARD_RPTUN_CHANNEL1_VRING0_ADDR,
+          .align    = BOARD_RPTUN_VRING_ALIGN,
+          .num      = BOARD_RPTUN_VRING_NUM,
+          .notifyid = BOARD_RPTUN_CHANNEL1_NOTIFYID,
+        },
+      .rpmsg_vring1 =
+        {
+          .da       = BOARD_RPTUN_CHANNEL1_VRING1_ADDR,
+          .align    = BOARD_RPTUN_VRING_ALIGN,
+          .num      = BOARD_RPTUN_VRING_NUM,
+          .notifyid = BOARD_RPTUN_CHANNEL1_NOTIFYID,
+        },
+    },
+};
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: rzv2h_rptun_resource_initialize
+ ****************************************************************************/
+
+FAR struct resource_table *rzv2h_rptun_resource_initialize(void)
+{
+  memcpy(g_rzv2h_resources, g_rzv2h_resources_init,
+         sizeof(g_rzv2h_resources));
+
+  /* The live table is in normal, non-cacheable shared memory.  Complete the
+   * initialization before Linux is allowed to observe VirtIO state there.
+   */
+
+  UP_DSB();
+  return (FAR struct resource_table *)
+         &g_rzv2h_resources[BOARD_RPTUN_CHANNEL];
+}
+
+/****************************************************************************
+ * Name: rzv2h_rptun_resource_reset
+ ****************************************************************************/
+
+void rzv2h_rptun_resource_reset(void)
+{
+  memcpy(&g_rzv2h_resources[BOARD_RPTUN_CHANNEL],
+         &g_rzv2h_resources_init[BOARD_RPTUN_CHANNEL],
+         sizeof(g_rzv2h_resources[BOARD_RPTUN_CHANNEL]));
+
+  /* Linux owns the virtio DRIVER_OK bit.  Clear the completed session and
+   * publish a fresh table so the NuttX RPTUN start thread waits for the next
+   * Linux rpmsg_sample_client instance before recreating its virtqueues.
+   */
+
+  UP_DSB();
+}
diff --git a/boards/arm/rzv2h/rzv2h-rdk/src/rzv2h_rsctable.h 
b/boards/arm/rzv2h/rzv2h-rdk/src/rzv2h_rsctable.h
new file mode 100644
index 00000000000..5505090b75c
--- /dev/null
+++ b/boards/arm/rzv2h/rzv2h-rdk/src/rzv2h_rsctable.h
@@ -0,0 +1,45 @@
+/****************************************************************************
+ * boards/arm/rzv2h/rzv2h-rdk/src/rzv2h_rsctable.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __BOARDS_ARM_RZV2H_RZV2H_RDK_SRC_RZV2H_RSCTABLE_H
+#define __BOARDS_ARM_RZV2H_RZV2H_RDK_SRC_RZV2H_RSCTABLE_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/compiler.h>
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+struct resource_table;
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+FAR struct resource_table *rzv2h_rptun_resource_initialize(void);
+void rzv2h_rptun_resource_reset(void);
+
+#endif /* __BOARDS_ARM_RZV2H_RZV2H_RDK_SRC_RZV2H_RSCTABLE_H */

Reply via email to