CV-Bowen opened a new pull request, #21542:
URL: https://github.com/apache/nuttx/pull/21542

   ## Summary
   
   Replace the rptun command mailbox in the resource table with a status
   bitmap, and fold the panic API into reset.
   
   - `include/sys/boardctl.h`: define the reset cause types
     unconditionally; rptun exchanges `BOARDIOC_SOFTRESETCAUSE_*` with the
     peer also without `CONFIG_BOARDCTL_RESET`.
   - Fold `RPTUNIOC_PANIC`, `RPTUN_CMD_PANIC` and `ops->panic` into reset
     with `BOARDIOC_SOFTRESETCAUSE_PANIC` as the value; `ops->reset` and
     `rptun_reset()` take an `unsigned long` reason and `ops->reset`
     returns `int`. stm32h7 and nrf53 are converted.
   - One panic notifier and one reboot notifier (stop the peers on
     restart/poweroff) for all rptun devices.
   - Number `RPTUNIOC_*` from 1 now that rptun has its own ioctl base.
   - Replace the master/slave command words with a status bitmap per side:
     a core sets the bit of its reset reason, flushes it and notifies the
     peer, which panics or resets. ivshmem uses `hdr.ver` as its ready
     flag and sim drops its stop command, both of which used the command
     words. `ops->reset` returning `-ENOTSUP` falls back to the bitmap.
     `RPTUN_CMD_TIMEOUT_MS` becomes `RPTUN_STATUS_TIMEOUT_MS`.
   - Smaller fixes on the way: skip status handling before the resource
     table is loaded, and return the reset result from `RPTUNIOC_RESET`.
   - The first commit fixes nxstyle errors already on master in the three
     arch rptun drivers.
   
   ## Impact
   
   API/ABI break for rptun users: `rptun_panic()`, `RPTUN_PANIC()`,
   `ops->panic` and `RPTUNIOC_PANIC` are removed (use `rptun_reset()`
   with `BOARDIOC_SOFTRESETCAUSE_PANIC`); `ops->reset` is now
   `int (*)(dev, unsigned long)`; `RPTUNIOC_*` values change. Both cores
   of a link must run this version, since the resource table words change
   meaning. Kconfig: `RPTUN_CMD_TIMEOUT_MS` is renamed
   `RPTUN_STATUS_TIMEOUT_MS`. nsh's `rptun` command and nxinit only need a
   rebuild.
   
   ## Testing
   
   Host: Ubuntu 22.04.5 LTS x86_64, QEMU version 10.2.1, sim: cc (Ubuntu 
13.1.0-8ubuntu1~22.04) 13.1.0, qemu-armv8a: aarch64-none-elf-gcc (Arm GNU 
Toolchain 12.2.Rel1 (Build arm-12.24)) 12.2.1 20221205
   
   Every commit builds without warnings on sim:rpserver,
   qemu-armv8a:rpserver, qemu-armv7a:rpserver, nucleo-h745zi:nsh_cm7_rptun,
   nucleo-h745zi:nsh_cm4_rptun, nrf5340-dk:rptun_cpuapp and
   nrf5340-dk:rptun_cpunet.
   
   **Reset reasons over the status bitmap**, qemu-armv8a:rpserver +
   qemu-armv8a:rpproxy (ivshmem rptun), booted as in their README; from
   the server:
   
   ```
   server> rpmsg ping all 3 64 3 0
   server> rptun reset /dev/rptun/proxy 2     # BOARDIOC_SOFTRESETCAUSE_PANIC
   ```
   
   | | master | this PR |
   |---|---|---|
   | ping | 3/3 | 3/3 |
   | `reset ... 2` (panic) | the value goes out as a plain reset; the proxy 
asserts in its rx interrupt (see below) | proxy: `FATAL: Panic by remote core: 
server` and panics |
   
   `rptun reset /dev/rptun/proxy 0` (user reboot) asserts on the proxy on
   master and with this PR alike: the peer runs `boardctl(BOARDIOC_RESET)`
   from its rx notification in interrupt context, and the reboot notifier
   of rpmsg_port_uart then waits on an event:
   
   ```
   Assertion failed event != ((void*)0) && (...)
     at file: /sched/event/event_wait.c:120 task: Idle_Task
   nxevent_tickwait / rpmsg_port_uart_reboot_notifier / boardctl
   rptun_check_peer_status (rptun_check_command on master) / rptun_callback
   rptun_ivshmem_wdog / wd_timer / arm64_arch_timer_compare_isr
   ```
   
   Deferring that `boardctl()` to a work queue is left to a follow-up PR.
   
   Not run: stm32h7 and nrf53 on hardware (build only).
   
   Baseline: No regression in rpmsg: sim:rpserver/rpproxy and 
qemu-armv8a:rpserver/rpproxy boot and pass the fixed rpmsg cases (dump, ping, 
rpmsgfs; 15/15). qemu-armv8a was built with LIBC_ENVPATH and BINFMT_CHECKEXEC 
disabled, which current master needs for nxinit to start nsh there; unrelated 
to this change.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

  • [PR] drivers/rptun: replace t... CV-Bowen (via GitHub) via commits

Reply via email to