This commit added dependency on CONFIG_SYSTEM_TIME64 for the hrtimer, sin
ce the hrtimer use `clock_compare` to compare 64-bit time.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit renamed the callback type to `hrtimer_entry_t`, aligning with
the `wdentry_t` in wdog..
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
The expired field can not be used to indicate the cancelled state. Because
the `UINT64_MAX` is valid expired time. A periodic hrtimer started with
the hrtimer_start_absolute(hrtimer, period_func, UINT64_MAX) can
not be cancelled via `hrtimer_cancel`.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
Calling `virtio_free_buf` or `kmm_free` inside IRQ may lead to dead lock
inside `mm_free`, so we use a free list to store the buffer and reuse it
next time. Fortunately, NuttX only uses one async buffer at same time,
so we don't need to consider how to free the buffer because we won't
have too many in the free list.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
Replace enter_critical_section() with spinlock-based protection to
avoid sleeping in atomic or interrupt contexts.
Signed-off-by: xucheng5 <xucheng5@xiaomi.com>
Fix the misspelling of the tick timeout API name
(tick_settimeouot -> tick_settimeout) for clarity and correctness.
This corrects a typographical error in the function/config name that
could lead to confusion and incorrect usage. No functional logic is
changed by this rename.
Signed-off-by: zhaohaiyang1 <zhaohaiyang1@xiaomi.com>
The rpmsg_ioctl() function will first obtain the read lock before
traversing g_rpmsg, then the rpmsg_dev_destory function will try
to obtain the write lock.
At this time, rpmsg_ioctl does not release the read lock, resulting
in a deadlock.
To solve this problem, add a standardalone list for the rptun instance
to avoid hold the rpmsg lock when execute rptun_poweroff()
Backtrace:
Thread 14 nsh_main
0 0x4412b9da in up_switch_context (tcb=0xeac03380, rtcb=0xe7f02480) at sim/sim_switchcontext.c:95
1 0x43fbe5e4 in nxsem_wait_slow (sem=0x5179d570 <g_rpmsg_lock+16>) at semaphore/sem_wait.c:170
2 0x43fbeacf in nxsem_wait (sem=0x5179d570 <g_rpmsg_lock+16>) at semaphore/sem_wait.c:272
3 0x44671a26 in down_write (rwsem=0x5179d560 <g_rpmsg_lock>) at semaphore/sem_rw.c:248
4 0x4401e255 in rpmsg_device_destory (rpmsg=0xe7b03280) at rpmsg/rpmsg.c:469
5 0x4402f5fe in rptun_dev_stop (rproc=0xe7b033e4, stop_ns=true) at rptun/rptun.c:973
6 0x4402aa28 in rptun_ioctl (rpmsg=0xe7b03280, cmd=11109, arg=0) at rptun/rptun.c:661
7 0x4401ba1e in rpmsg_dev_ioctl_ (rpmsg=0xe7b03280, cmd=11109, arg=0) at rpmsg/rpmsg.c:137
8 0x4401ee88 in rpmsg_ioctl (cpuname=0x0, cmd=11109, arg=0) at rpmsg/rpmsg.c:562
9 0x44030cb0 in rptun_poweroff (cpuname=0x0) at rptun/rptun.c:1183
10 0x43f27be2 in board_power_off (status=0) at sim/sim_head.c:211
11 0x446fd933 in boardctl (cmd=65283, arg=0) at boardctl.c:401
12 0x44313b95 in cmd_poweroff (vtbl=0xe7600e80, argc=1, argv=0xe7824350) at nsh_syscmds.c:368
13 0x442d148c in nsh_command (vtbl=0xe7600e80, argc=1, argv=0xe7824350) at nsh_command.c:1275
14 0x442f65f5 in nsh_execute (vtbl=0xe7600e80, argc=1, argv=0xe7824350, param=0xe78242b0) at nsh_parse.c:716
15 0x44304fb4 in nsh_parse_command (vtbl=0xe7600e80, cmdline=0xe7601338 "poweroff") at nsh_parse.c:2809
16 0x44305a50 in nsh_parse (vtbl=0xe7600e80, cmdline=0xe7601338 "poweroff") at nsh_parse.c:2919
17 0x442bdc91 in nsh_session (pstate=0xe7600e80, login=1, argc=1, argv=0xe7814870) at nsh_session.c:246
18 0x442bbbe5 in nsh_consolemain (argc=1, argv=0xe7814870) at nsh_consolemain.c:75
19 0x4422b4bb in nsh_main (argc=1, argv=0xe7814870) at nsh_main.c:74
20 0x440ee098 in nxtask_startup (entrypt=0x4422b39a <nsh_main>, argc=1, argv=0xe7814870) at sched/task_startup.c:72
21 0x43fa1d6e in nxtask_start () at task/task_start.c:116
22 0x4412982c in pre_start () at sim/sim_initialstate.c:53
23 0x00000000 in ?? ()
Signed-off-by: wangshaoxin <wangshaoxin@xiaomi.com>
When execute 'rptun stop /dev/rptun/proxy' in the nsh,
rpmsg_deinit_vdev(&priv->rvdev) will set rvdev->vdev = NULL,
then the remoteproc_remove_virtio(priv->rvdev.vdev) input is NULL,
which will cause crash, the backtrace as follow, so we save the
rvdev->vdev pointer on vdev to solve this problem.
(gdb) bt
0 _assert (filename=0x4002aecc <nxrmutex_destroy+8> "\005D\220\v", linenum=1038, msg=0x400a26a8 "tx_vq", regs=0x400a2768) at misc/assert.c:827
1 0x4002a1db in __assert (filename=0x400a2204 "open-amp/lib/remoteproc/remoteproc.c", linenum=1038, msg=0x0) at assert/lib_assert.c:38
2 0x4006fd83 in remoteproc_remove_virtio (rproc=0xf3ea1880, vdev=0x0) at open-amp/lib/remoteproc/remoteproc.c:1038
3 0x4001b01d in rptun_dev_stop (rproc=0xf3ea1880, stop_ns=true) at rptun/rptun.c:979
4 0x4001a45e in rptun_ioctl (rpmsg=0xf3ea16d0, cmd=11109, arg=0) at rptun/rptun.c:661
5 0x40017246 in rpmsg_dev_ioctl_ (rpmsg=0xf3ea16d0, cmd=11109, arg=0) at rpmsg/rpmsg.c:138
6 0x4001728e in rpmsg_dev_ioctl (filep=0xf3d70a14, cmd=11109, arg=0) at rpmsg/rpmsg.c:153
7 0x4005ef51 in file_vioctl (filep=0xf3d70a14, req=11109, ap=0xf3d80f2c "\352\r\004@F\023\004@\230\020\330\363\353;\354\363(7\354", <incomplete sequence \363>)
at vfs/fs_ioctl.c:70
8 0x4005f2ff in ioctl (fd=3, req=11109) at vfs/fs_ioctl.c:294
9 0x40041049 in cmd_rpmsg_once (vtbl=0xf3ec3728, path=0xf3ec3beb "/dev/rptun/proxy", argv=0xf3d81098, rpmsg_cb=0x40041346 <cmd_rptun_cb>) at nsh_syscmds.c:616
10 0x400415c8 in cmd_rptun (vtbl=0xf3ec3728, argc=3, argv=0xf3d81098) at nsh_syscmds.c:766
11 0x40036024 in nsh_command (vtbl=0xf3ec3728, argc=3, argv=0xf3d81098) at nsh_command.c:1275
12 0x4003d044 in nsh_execute (vtbl=0xf3ec3728, argc=3, argv=0xf3d81098, param=0xf3d81078) at nsh_parse.c:716
13 0x4003efcc in nsh_parse_command (vtbl=0xf3ec3728, cmdline=0xf3ec3be0 "rptun") at nsh_parse.c:2809
14 0x4003f129 in nsh_parse (vtbl=0xf3ec3728, cmdline=0xf3ec3be0 "rptun") at nsh_parse.c:2919
15 0x40033ca4 in nsh_session (pstate=0xf3ec3728, login=1, argc=1, argv=0xf3d70ae0) at nsh_session.c:246
16 0x400338ea in nsh_consolemain (argc=1, argv=0xf3d70ae0) at nsh_consolemain.c:75
17 0x40033845 in nsh_main (argc=1, argv=0xf3d70ae0) at nsh_main.c:74
18 0x4002bc9f in nxtask_startup (entrypt=0x400337d0 <nsh_main>, argc=1, argv=0xf3d70ae0) at sched/task_startup.c:72
19 0x400077cc in nxtask_start () at task/task_start.c:116
20 0x40031d2f in pre_start () at sim/sim_initialstate.c:53
21 0x00000000 in ?? ()
Signed-off-by: mazhuang <mazhuang@xiaomi.com>
return -EAGAIN will cause rpmsg_virtio_get_tx_payload_buffer() in
OpenAMP break immediately, but should return to the sleep() logic
to wait buffer is return.
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
The reference count (upper->crefs) is incremented in timer_open()
only after ensuring it will not overflow, timer_close() is only
called after a successful open. Therefore, crefs should never be
zero when timer_close() is called. The check for crefs > 0 before
decrementing is unnecessary and has been removed to simplify the code.
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
Ensure the CMake build explicitly locates and links libstdc++.a
when CONFIG_LIBCXXTOOLCHAIN is enabled. This aligns CMake behavior
with the Make build system and fixes STL/libc header conflicts
observed on xmc4800-relax:nsh.
Signed-off-by: trns1997 <trns1997@gmail.com>
Commit e5db83d7db introduced a change to the file updated by this patch
which caused a build-time warning about unused variable. This patch
removes declaration of the variable from the code.
This patch also updates comment that relates to what was changed
in the commit.
Patch was tested by building breadxavr:nsh - resulting binary is identical
(by SHA256 checksum) and the warning is no longer present.
Signed-off-by: Kerogit <kr.git@kerogit.eu>
Per further feedback from Litex community, the vexriscv cache is
write-through so no flush is required - therefore, make it a nop.
And add a pointer to vexriscv invalidation magic instr docs.
Signed-off-by: Justin Erenkrantz <justin@erenkrantz.com>
Introduce CONFIG_LIBC_DISABLE_HEXSTR_TO_FLOAT to remove support for
parsing hexadecimal floating-point constants (C99 %a) in strtod(),
strtof(), strtold(), and sscanf("%a"). This feature is rarely used in
embedded systems and its removal saves significant flash space. Decimal
float parsing remains unaffected.
Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
If a ns_bind message come at between traverse g_rpmsg_cb and add g_rpmsg_cb list,
the cb->node has not been added to the g_rpmsg_cb list yet.
So rpmsg_ns_bind will not find this callback and not call the cb->ns_bind()
to notify the rpmsg services.
Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
The reconnect will fail because the state changes to connecting when
shutdown cmd is still in process.
And after the shutdown cmd processed, it will reset the state to
unconnected, even though the connect cmd is in ready list,
it will still not be processed.
This patch solve this issue.
Signed-off-by: liaoao <liaoao@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
If connect cmd is dropped during the shutdown cmd process, it will
not be able to reconnect because current side will not try to send
connect cmd after shutdown cmd processed.
So change state to connecting when received connect cmd during the
shutdown cmd process.
Signed-off-by: liaoao <liaoao@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Now rpmsg port spi can receive peer's suspend and resume command,
suspend command means peer enter into the lowpower state and
resume command means peer waked up
These two commands can let us know peer's running status, so we
will modify the rpmsg signals to let the rpmsg service can get
peer's running state too.
Signed-off-by: liaoao <liaoao@xiaomi.com>
Shutdown mean peer's want to disconnect the connection untial
peer want connect with local side again.
After receive shutdown command, local will clear the state until
reconnecting and clear the gpio status to avoid the leak current.
Signed-off-by: liaoao <liaoao@xiaomi.com>
Because rxq may have received reconnection data, when connect state
changed to unconnected but the reconnect data has not been processed,
and during that time there is a tx buffer to be sent, the
drop_packets may drop the reconnect data and two sides can not
reconnected anymore.
Signed-off-by: liaoao <liaoao@xiaomi.com>
1. add error log when transferring keeps rasing because of no spi
exchange complete callback;
2. this log can also be used to check if there is an interrupt has
been caught when peer side keeps trying to send data;
Signed-off-by: liaoao <liaoao@xiaomi.com>
0x106b9ad2 in metal_list_del (node=<optimized out>) at /home/yintao/O61/nuttx/include/metal/list.h:85
rpmsg_unregister_endpoint (ept=0x1857ba30) at open-amp/lib/rpmsg/rpmsg.c:296
rpmsg_destroy_ept (ept=0x1857ba30) at open-amp/lib/rpmsg/rpmsg.c:389
0x102b871a in rpmsg_router_hub_unbind (ept=0x1857b330) at rpmsg/rpmsg_router_hub.c:139
0x102b7fec in rpmsg_device_destory (rpmsg=rpmsg@entry=0x1859e4e8) at rpmsg/rpmsg.c:486
0x102b9928 in rpmsg_port_unregister (port=port@entry=0x1859e4e8) at rpmsg/rpmsg_port.c:749
0x102b9bca in rpmsg_port_spi_process_packet (rxhdr=0x185ba718, rpspi=<optimized out>) at rpmsg/rpmsg_port_spi.c:408
rpmsg_port_spi_thread (argc=<optimized out>, argv=<optimized out>) at rpmsg/rpmsg_port_spi.c:452
0x102aa96e in nxtask_start () at task/task_start.c:111
Signed-off-by: yintao <yintao@xiaomi.com>
Users can add or delete Vlan interfaces through the vconfig tool. This document describes the usage of vconfig.
Signed-off-by: gaohedong <gaohedong@xiaomi.com>
Protect usrsock_rpmsg_server resources through conn_lock, avoid lack
of protection for usrsock_rpmsg_server after net_lock modification.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>