Commit Graph

1091 Commits

Author SHA1 Message Date
yangjianqing 1e4e80a1ca Revert "net:debug patch"
Reason for revert: <no need debug info>

Signed-off-by: yangjianqing <yangjianqing@xiaomi.com>
2026-04-21 01:36:02 +08:00
dongjiuzhu1 72ac8c984f net: removing bmp marco and using global mempool
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-04-21 01:34:39 +08:00
zhanghongyu c91603d681 net: replace net_sem*wait with conn_dev_sem*wait to simplify code logic
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:34:34 +08:00
dongjiuzhu1 bdd4f35a68 net: add per cpu support under bmp mode
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-04-21 01:33:57 +08:00
zhanghongyu f3fe2867dd net: fix crash caused by uninitialized memory
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:33:51 +08:00
zhanghongyu c07debc7b7 devif_callback.c: mempool has double free detection, so remove duplicate logic
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:33:50 +08:00
zhanghongyu 7770a9c05d net: replace NET_BUFPOOL with MEMPOOL_DEFINE
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:33:49 +08:00
zhanghongyu 5ed35c57b0 devif_poll: only call the corresponding xxx_poll when there is data to be sent
reduce the execution consumption of irrelevant code

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:33:48 +08:00
zhanghongyu f10918c93f net/devif_callback: change flags type from uint16_t to uint32_t
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:33:28 +08:00
yangjianqing 77bcef0121 net:debug patch
Signed-off-by: yangjianqing <yangjianqing@xiaomi.com>
2026-04-21 01:30:31 +08:00
zhanghongyu 90b5a28ec3 net/udp: remove net_lock
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:28:24 +08:00
gaohedong d11128fbef net/devif: fix poll issue when ifdown
When the interface is in a down state, it triggers a poll busy loop issue.

Signed-off-by: gaohedong <gaohedong@xiaomi.com>
2026-04-21 01:24:32 +08:00
zhanghongyu 0f33afaed4 net/net_initialize: remove the empty functions that are not needed
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:23:28 +08:00
Zhe Weng 2a3411dd1f net/bufpool: Call init automatically on alloc
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2026-04-21 01:16:56 +08:00
Zhe Weng e57abd9e3a net: Add buffer pool to replace connection allocation
Our net socket connection allocations are powerful but redundant
because they're implemented once in each protocol.  This is not good for
further optimizing and extending to other allocations, so maybe we can
add a common implementation for the usage.

Impact:
1. We add a `struct net_bufpool_s` as pool descriptor, which may use a
   little bit more memory than previous implementation (~28Bytes).
2. We share same functions between pools, so code size may shrink under
   some scenarios.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2026-04-21 01:16:55 +08:00
Alin Jerpelea 063372e896 net: migrate to SPDX identifier
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2026-04-21 01:01:23 +08:00
openvela-robot e44133cd68 rptun: minor nxstyle fix, sync with community
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-04-21 01:01:21 +08:00
openvela-robot 0d22531d60 misc/dev_mem: fix compile error in aarch64
misc/dev_mem.c:203:24: error: comparison between two arrays [-Werror=array-compare]
  203 |   bool merge = (_edata == _sbss);
      |                        ^~
misc/dev_mem.c:203:24: note: use '&_edata[0] == &_sbss[0]' to compare the addresses

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-04-21 01:01:13 +08:00
openvela-robot 200b48bf35 procfs/cpuinfo: Zero copylen in cpuinfo_read
to avoid return the negative number

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2026-04-21 01:01:06 +08:00
openvela-robot 1b12410f95 mq: correct inode release in mq_inode_release()
Signed-off-by: ligd <liguiding1@xiaomi.com>
2026-04-21 01:01:01 +08:00
openvela-robot 923523ecec tools/gdb: support string type in offset_of
1. Support any type of value as pointer address in container_of
2. Support string as type in offset_of
3. Make sure type is a pointer in container_of, and not a pointer in
   offset_of

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2026-04-21 01:00:55 +08:00
openvela-robot bba9037914 usensor.c:fix container_of member error.
Signed-off-by: likun17 <likun17@xiaomi.com>
2026-04-21 01:00:47 +08:00
openvela-robot 793cd570f8 tools/gdb: decode backtrace of crashlog
Now crash log can be directly pass to addr2line tool to get all backtraces.

E.g.
(gdb) addr2line -f crash.log -p 485
Address              Symbol                           Source

Backtrace of 485
0x402cc0ac           <up_switch_context+84>           /home/work/ssd1/workspace/MiRTOS-specific product-Stable-Build/nuttx/include/arch/syscall.h:179
0x40291276           <nxsig_timedwait+386>            signal/sig_timedwait.c:365
0x4028fc7e           <nxsig_nanosleep+106>            signal/sig_nanosleep.c:141
0x4028fdba           <clock_nanosleep+26>             signal/sig_nanosleep.c:333
0x402c3736           <usleep+62>                      unistd/lib_usleep.c:108
0x415018c0           <cs2p2p_mSecSleep+24>            Src/PPPP_Common.c:1139
0x414fabde           <cs2p2p_Run_send_DRW+258>        Src/PPPP_API.c:5577
0x414fac62           <cs2p2p_PPPP_thread_send_DRW+18> Src/PPPP_API.c:5616
0x40446f62           <pthread_startup+10>             pthread/pthread_create.c:59
0x41094f4a           <pthread_start+106>              pthread/pthread_create.c:139

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2026-04-21 01:00:41 +08:00
openvela-robot 61f982bb25 fs/semaphore: fix a minor issue with goto label
Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2026-04-21 01:00:29 +08:00
openvela-robot 0dc07fb6b1 tools/gdb: imporve nxgcore speed
Let GDB to read from ELF for readonly data.
Disable this feature by nxgcore --no-trust-readonly.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2026-04-21 01:00:18 +08:00
openvela-robot d2ce98f28b fs_open:Adjust the definition of the open path
Summary:
  Reference https://man7.org/linux/man-pages/man2/open.2.html
       EISDIR pathname refers to a directory and the access requested
              involved writing (that is, O_WRONLY or O_RDWR is set).

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2026-04-21 01:00:11 +08:00
openvela-robot b09d89a476 risc-v: Support customize idle loop
Support customize idle loop by CONFIG_ARCH_IDLE_CUSTOM
as other architectures.

Then user can provide their own `up_idle()` function
with CONFIG_ARCH_IDLE_CUSTOM enabled.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2026-04-21 01:00:05 +08:00
openvela-robot 8d3b73559f timers: add goldfish timer support
Signed-off-by: ligd <liguiding1@xiaomi.com>
2026-04-21 00:59:57 +08:00
openvela-robot f506bd34c8 sched: synchronize with community code and use nxsched_remove_self.
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-04-21 00:59:51 +08:00
openvela-robot 5bb8c15749 arch: fix the sched parameter update when exiting
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2026-04-21 00:59:45 +08:00
openvela-robot b566da436e sim:support sim elf and dynamic libs package in post build
use the dynamic library .so of the binding compilation environment,
and then modify the dynamic loader of elf at runtime to run sim elf across system versions

1.add post-build for sim build
2.collect dynamic .so and dynamic interpreter
3.add execution script for the entire package sim elf

change text-segment to 0x50000000
because patchelf will modify the .dynamic section in elf,
the upward alignment of elf will be less than 0x3fffffff,
which will cause asan shadow memory overlap error

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2026-04-21 00:59:38 +08:00
openvela-robot 57e00d628f arch/arm64/src/imx9/imx9_usbdev.c: Clean up cache operations, add DEBUGASSERTS
Correct some of the cache operations:

- EP0 request length was handled incorrectly
- Received data cache invalidate was exceeding the received buffer
- writedtd is also called with no data (EP0 ACK/NACK). Don't touch cache in that case.

Fix trip wire handling to conform with the IMX93 reference manual

Also add DEBUGASSERTS for future to check the validity of pointers and sizes

Co-authored-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2026-04-21 00:59:15 +08:00
openvela-robot 2f6c45cb01 arch/intel64: optimise context switch
We save interrupted TCB state on tcb->xcp.regs not interrupt stack now
which allows us to remove x86_64_savestate() from up_switch_context()
and other places.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2026-04-21 00:59:09 +08:00
openvela-robot 3d928157d7 build.yml: Undo debug print
Undo the unintended changes for debug printing. I edited the wrong repo, I am deeply sorry about this.
2026-04-21 00:59:01 +08:00
openvela-robot f2d0966e9b arch/intel64/intel64_head.S: align XCP region
align XCP region to match regs allocation in up_initial_state()

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2026-04-21 00:58:55 +08:00
openvela-robot bcd70711f4 pm: pm_idle add support for SMP
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2026-04-21 00:58:46 +08:00
openvela-robot 3c370f84e4 xtensa/Kconfig: Fix dependency for backtrace dump on Xtensas
`CONFIG_XTENSA_INTBACKTRACE` is necessary to enable backtrace dump
for the tasks because exceptions are treated like interrupts (even
when an exception occurs during a normal task execution). It's now
automatically selected when `CONFIG_SCHED_BACKTRACE` is enabled.
This commit also removes outdated Kconfig options.

Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
2026-04-21 00:58:41 +08:00
openvela-robot b8d0af587f pci ep support msi/msi-x test
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2026-04-21 00:58:28 +08:00
openvela-robot e32220e3b2 tools/gdb: add utils.get_tid(tcb)
Signed-off-by: huangyin5 <huangyin5@xiaomi.com>
2026-04-21 00:58:22 +08:00
openvela-robot b56c30d859 clock: correct compile failed
LD: nuttx.elf
ld: /home/ligd/platform/mainline/nuttx/staging/libsched.a(mq_sndinternal.o): in function `wd_start_realtime':
/home/ligd/platform/mainline/nuttx/include/nuttx/wdog.h:274: undefined reference to `clock_realtime2absticks'
/home/ligd/platform/mainline/nuttx/include/nuttx/wdog.h:274:(.text+0xad): relocation truncated to fit: R_X86_64_PLT32 against undefined symbol `clock_realtime2absticks'
ld: /home/ligd/platform/mainline/nuttx/staging/libsched.a(mq_rcvinternal.o): in function `wd_start_realtime':
/home/ligd/platform/mainline/nuttx/include/nuttx/wdog.h:274: undefined reference to `clock_realtime2absticks'
/home/ligd/platform/mainline/nuttx/include/nuttx/wdog.h:274:(.text+0xad): relocation truncated to fit: R_X86_64_PLT32 against undefined symbol `clock_realtime2absticks'
make[1]: *** [Makefile:128: nuttx.elf] Error 1
make: *** [tools/Unix.mk:551: nuttx.elf] Error 2

Signed-off-by: ligd <liguiding1@xiaomi.com>
2026-04-21 00:58:16 +08:00
openvela-robot 6710e90b11 misc/rpmsgdev: The private data should be freed only when endpoint is released
A use-after-free problem occurs when there are multiple remotes in the list `g_rpmsg` and the matching remote is not the last item in the list.

Log
  # Export the device "/dev/LOCAL_DEV" to remote "REMOTE_CPU"
  ap> testdev -d 2 -c "REMOTE_CPU" -l "/dev/LOCAL_DEV"
  [ap] kasan_report: kasan detected a read access error, address at 0x3c3d4740,size is 4, return address: 0x2c33620f
  [ap] kasan_show_memory: Shadow bytes around the buggy address:
  [ap] kasan_show_memory:   0x3c3d46f0: cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc
  [ap] kasan_show_memory:   0x3c3d4700: aa aa aa aa cc cc cc cc cc cc cc cc cc cc cc cc
  [ap] kasan_show_memory:   0x3c3d4710: 40 47 3d 3c ed 61 33 2c 00 00 00 00 00 00 00 00
  [ap] kasan_show_memory:   0x3c3d4720: 00 00 00 00 00 00 00 00 00 00 00 00 cc cc cc cc
  [ap] kasan_show_memory:   0x3c3d4730: 55 55 55 55 38 00 00 00 02 2c 00 00 cc cc cc cc
  [ap] kasan_show_memory:   0x3c3d4740:[00 00 00 00]66 e0 42 3c cc cc cc cc cc cc cc cc
  [ap] kasan_show_memory:   0x3c3d4750: cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc
  [ap] kasan_show_memory:   0x3c3d4760: aa aa aa aa 38 00 00 00 01 2c 00 00 cc cc cc cc
  [ap] kasan_show_memory:   0x3c3d4770: 50 57 44 3d 2f 00 cc cc cc cc cc cc cc cc cc cc
  [ap] kasan_show_memory:   0x3c3d4780: cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc
  [ap] dump_assert_info: Current Version: NuttX ****** ***** *** 12.3.0 **********-***** *** ** 2024 **:**:** arm
  [ap] dump_assert_info: Assertion failed panic: at file: kasan/hook.c:187 task: testdev process: testdev 0x2ca20495

  $ addr2line -fe nuttx/nuttx 0x2c33620f
  rpmsgdev_server_created
  /workspace/nuttx/drivers/misc/rpmsgdev_server.c:529
  # Line 529 => strcmp()

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2026-04-21 00:58:11 +08:00
openvela-robot 7d0ed7199c binfmt/modlib: support loading each sections to different memory for Relocate object
The feature depends on ARCH_USE_SEPARATED_SECTION
the different memory area has different access speed and cache
capability, so the arch can custom allocate them based on
section names to achieve performance optimization

test:
sim:elf
sim:sotest

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-04-21 00:58:06 +08:00
openvela-robot 1c3ffd2fb6 arm64:svc call use task stack
kernel build if svc call use irq stack the irq maybe touch
svc stack, svc call use task stack can avoid this case

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2026-04-21 00:58:00 +08:00
openvela-robot e076a236fe arm64 fork: FORK_REG_LR,FORK_REG_SP should save the func local stack
not the last func stack

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2026-04-21 00:57:55 +08:00
openvela-robot f138669485 Revert "irq: add [enter|leave]_critical_section_nonirq"
This reverts commit 62d3fe9fccc8d5b056f5bc0c7fd715beddfed405.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-04-21 00:57:50 +08:00
openvela-robot 70ad088045 lib_fdopendir.c:Fix crash in fdopendir caused by fdsan
Summary:
  Add fdsan check in fdopendir, fdsan can work normally when using fdopendir

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2026-04-21 00:57:44 +08:00
openvela-robot fbd0b2baf6 nuttx/libcxx: Fix clang compilation cannot recognize compilation options error.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2026-04-21 00:57:39 +08:00
openvela-robot 490ccb9dd1 arm64/smp: changing the startup of arm64 SMP from serial to parallel
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-04-21 00:57:34 +08:00
openvela-robot c2e7969add add dependencies for nuttx_post
nuttx_post depends systemmap and usermap(in protected build mode)

Signed-off-by: pangzhen1 <pangzhen1@xiaomi.com>
2026-04-21 00:57:28 +08:00
wangchen 51a65207fe devif:fix issue about devif_callback being released wrongly,resulting in no access to it
Signed-off-by: wangchen <wangchen41@xiaomi.com>
2026-04-21 00:57:23 +08:00