1. Add cmake support for rptun_serure;
2. Move rptun_secure.c before rptun_ivshmem.c in Make.defs to follow
the order in Kconfig.
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Master can send restart command to slave to reboot the slave core
Signed-off-by: mazhuang <mazhuang@xiaomi.com>
Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
Because locate the command at the end the resource table is unfriendly
when we want to support multi virtio devices instead only one virtio
rpmsg device.
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Add more common command for rptun and rpmsg_virtio frameworks,
also modify the rptun and rpmsg_virtio driver to use the common
commands.
Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
Move the panic logic in common places, later we can move more logic to
the framework instead of having the drivers implement it repeatedly.
Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
headrx is very convient to check weather current core miss interrupt
by comparing the headrx with the rx vring avail.idx for slave side or
rx vring used.idx for master side.
So move headrx out of the CONFIG_RPTUN_PM range.
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
rptun_dump related code has been moved to rptun.c from rptun_dump.c,
but file rptun_dump.c is not deleted in PR:
https://github.com/apache/nuttx/pull/11712
So delete this file.
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Store the rx virtqueue idx to the local headrx index, and only
process the data when the rx virtqueue has data to avoid access
the ram in low power mode.
Signed-off-by: ligd <liguiding1@xiaomi.com>
rptun secure is a rptun driver used for the rpmsg communication
between (Non-Secure) REE and (Secure) TEE environments.
Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Add get_local_cpuname to the rpmsg framework ops to support communicate
with the same remote core with multi rpmsg transport.
Some rpmsg services will send local cpu name to remote core and then let
remote core to connect local core by using this cpu name, when there are
multi rpmsg channels with same remote core, the remote core may connect
to incorrect core, so use the error rpmsg channel.
For example, there are two rpmsg channels between ap and audio:
ap core audio core
[ap1] <-- rpmsg virtio1 --> [audio1]
[ap2] <-- rpmsg virtio2 --> [audio2]
When we want to use the rpmsg virtio1 to communicate, ap core may send
local cpuname "ap2" to audio, so the audio core use remote cpu "ap2" to
connect with ap, and resulting in the use of incorrect rpmsg channel.
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Rptun is a rptun fremework driver base on the Inter-Virtual Machine
Share Memory Device.
With this driver, two NuttX runs in different QEMU can communicate
with each other by the rpmsg api.
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
In the previous patch, we moved rptun_panic and rptun_dump_all in rptun to rpmsg.
In order to ensure CI pass, this two API in rptun is not removed. So we remove rptun_panic and rptun_dump_all in this patch.
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
It should be possible to use ping without rptun being enabled, so striped rptun_ping out of rptun and rename to rpmsg_ping.
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
nuttx/driver/rpmsg: new folder, extract common rpmsg api in rptun.c to rpmsg.c.
rpmsg provide rpmsg_ops to each backend for specific implementation.
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
Race condition if the remote proc is stoped during initialization phase
| #0 0x0249f959 in rpmsg_destroy_ept (ept=0xffffffc0) at open-amp/lib/rpmsg/rpmsg.c:376
| #1 0x024a938c in rpmsg_deinit_vdev (rvdev=0xf2303a48) at open-amp/lib/rpmsg/rpmsg_virtio.c:971
| #2 0x02117e33 in rptun_dev_stop (rproc=0xf2303a04, stop_ns=true) at rptun/rptun.c:891
| #3 0x021181d8 in rptun_do_ioctl (priv=0xf2303a00, cmd=11010, arg=0) at rptun/rptun.c:922
| #4 0x02119722 in rptun_ioctl_foreach (cpuname=0x0, cmd=11010, value=0) at rptun/rptun.c:1086
| #5 0x0211b9df in rptun_poweroff (cpuname=0x0) at rptun/rptun.c:1378
| #6 0x02053aa6 in board_power_off (status=0) at sim/sim_head.c:206
| #7 0x0253d65c in boardctl (cmd=65283, arg=0) at boardctl.c:400
| #8 0x021eb497 in cmd_poweroff (vtbl=0xef606280, argc=1, argv=0xef9b73e0) at nsh_syscmds.c:356
| #9 0x021cdb4d in nsh_command (vtbl=0xef606280, argc=1, argv=0xef9b73e0) at nsh_command.c:1164
| #10 0x021baa72 in nsh_execute (vtbl=0xef606280, argc=1, argv=0xef9b73e0, redirfile=0x0, oflags=0) at nsh_parse.c:845
| #11 0x021c6b0a in nsh_parse_command (vtbl=0xef606280, cmdline=0xef606708 "poweroff") at nsh_parse.c:2744
| #12 0x021c7166 in nsh_parse (vtbl=0xef606280, cmdline=0xef606708 "poweroff") at nsh_parse.c:2828
| #13 0x0221fa2f in nsh_session (pstate=0xef606280, login=1, argc=1, argv=0xef7a7860) at nsh_session.c:245
| #14 0x021f8c04 in nsh_consolemain (argc=1, argv=0xef7a7860) at nsh_consolemain.c:75
| #15 0x021b77eb in nsh_main (argc=1, argv=0xef7a7860) at nsh_main.c:74
| #16 0x02166ddf in nxtask_startup (entrypt=0x21b76ca <nsh_main>, argc=1, argv=0xef7a7860) at sched/task_startup.c:70
| #17 0x020b363c in nxtask_start () at task/task_start.c:134
Signed-off-by: chao an <anchao@xiaomi.com>