Commit graph

7542 commits

Author SHA1 Message Date
chao an
5aa13bc490 sched/spinlock: remove nesting spinlock support
developers must be careful to hold spinlocks and ensure all
of protected code is under control, so remove support for nested
spinlocks to improve performance.

Signed-off-by: chao an <anchao@lixiang.com>
2024-10-12 11:18:10 +08:00
makejian
e8a890ef42 nuttx/syscall: export nxsem_getprioceiling and nxsem_setprioceiling via syscall
Signed-off-by: makejian <makejian@xiaomi.com>
2024-10-12 09:50:54 +08:00
ligd
5c29c18199 mm.h: remove depends on addrenv.h
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-12 09:29:37 +08:00
ligd
76e77ff184 assert: add header files to resolve compile failed
error: 'NULL' undecleard

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-12 09:29:37 +08:00
liaoao
82ef95b6e2 rpmsg_port_spi_slave: fix compile error when enable RPMSG_PORT_SPI_SLAVE only
Signed-off-by: liaoao <liaoao@xiaomi.com>
2024-10-11 21:20:45 +08:00
Bowen Wang
313d6df787 include/nuttx.h: replace all the align macros to nuttx version
1. add IS_ALIGNED()  definitions for NuttX;
2. replace all the ALIGN_UP() and ALIGN_DOWN() to use common
   align implementation;

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-11 16:55:43 +08:00
Yongrong Wang
4b77dd03db rpmsg_ping.c: change msg cmd type for more compatible
Use bit mask method to represent the command, because it's more
convenient to express multiple characteristics simultaneously.

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-10-11 14:59:26 +08:00
cuiziwei
6ad06ba004 note:unified note filtering at runtime.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-11 11:55:17 +08:00
yinshengkai
a70175ea06 note: make sched_note_start depend on INSTRUMENTATION_SWITCH
In some cases, we only need to use INSTRUMENTATION_DUMP to record custom data,
and we don't want the thread start and end information

Move this part to INSTRUMENTATION_SWTICH for recording

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-11 11:55:17 +08:00
yinshengkai
453cde945f note: add note stream drivers
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-11 11:55:17 +08:00
yinshengkai
ec691cc5e4 tools: prasetrace.py supports parsing syslog
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-11 01:30:11 +08:00
yinshengkai
211a56910a syslog: support syslog redirection to sched_note
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-11 01:30:11 +08:00
yinshengkai
2fe33f551c assert: change the do-while of assert to a conditional expression
According to the standard definition, assert should return a void expression
https://pubs.opengroup.org/onlinepubs/007904875/basedefs/assert.h.html

This patch involves two changes:

If you define the NDEBUG macro, assert does not use any parameters and directly returns a void expression.
assert should return a void expression and cannot use do-while statements.
If the following code , a compilation error will occur.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-11 00:51:20 +08:00
yinshengkai
ba2865f20a sched: support backtrace record
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-11 00:37:27 +08:00
yinshengkai
02eb280302 arch/perf: modify the return value of up_perf_gettime to clock_t
When using alarm_arch implementation, 64-bit time can be returned. Using unsign long will cause precision loss.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-10 23:17:14 +08:00
Neo Xu
d598da80e4 Rename group_argvstr to nxtask_argvstr
Now argument vector is stored to TLS, task_argvstr fits better.

Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-10 23:13:37 +08:00
yinshengkai
d375a09c0a libs: add gprof arm64 support
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-10 18:46:51 +08:00
yinshengkai
eb8449cb0c sched/gprof: add gprof support
gprof can analyze code hot spots based on scheduled sampling.
After adding the "-pg" parameter when compiling, you can view the code call graph.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-10 18:46:51 +08:00
Xiang Xiao
4944bfd56c sched: Implement profil function
which is very useful for performance analysis:
https://man7.org/linux/man-pages/man3/profil.3.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-10 18:46:51 +08:00
anjiahao
f955eda358 uart_16550:fix bug, regincr is used multiple times
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-10 17:49:18 +08:00
hujun5
e249dd2672 arch: support customized up_cpu_index() in AMP mode
Some app with same code runs on different cores in AMP mode,
need the physical core on which the function is called.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2024-10-10 02:38:40 +08:00
Bowen Wang
092bdec20b drivers/serial: support force panic only when repeat the panic char
We can increase the panic repeat count to avoid abnormal crashes
caused by serial port interference.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-10 02:38:12 +08:00
Bowen Wang
bbb7f436d4 serial.c: should protect the fds when calling poll_notify
1. Use critical_section to protect the fds array;
2. Use critical_section and sched lock to protect the poll notify, because
   poll notify may cause context switch, delay the context swtich to
   sched_unlock();

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-10 02:38:12 +08:00
Bowen Wang
39449c6069 sched/sched.h: add nxsched_lock/unlock_irq() function
These two macros can be called in interrupt context and:
1. Do nothing when called in interrupt;
2. Same behavior as sched_lock/unlock when called in thread;

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-10 02:38:12 +08:00
ligd
80079f35e4 signal: add sig_tgkill() kenrnel version support
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-10 02:38:12 +08:00
sunjikun
ee306d47fd drivers/serial: Add 16550_DLF_SIZE option for DesignWare UART.
Signed-off-by: sunjikun <sunjikun@xiaomi.com>
2024-10-10 02:38:12 +08:00
Bowen Wang
89c49c53a7 virtio-mmio/pci: add alloc_buf/free_buf for mmio and pci transport layer
And remove the virtio_alloc/free_buf implementation in virtio.c, because
these two apis has been moved to the OpenAMP

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-09 23:32:58 +08:00
Yongrong Wang
1b24139020 virtio-pci/mmio: Features change to 64 bit in all virtio_dispatch and fix compile warning
virtio/virtio-pci-legacy.c:399:48: warning: passing argument 2 of ‘pci_bus_write_io_dword’ makes integer from pointer without a cast [-Wint-con>
  399 |   pci_write_io_dword(vpdev->dev, vpdev->ioaddr + VIRTIO_PCI_GUEST_FEATURES,
      |                                                ^
      |                                                |
      |                                                void *
/home/wyr/work/code/project/vela/nuttx/include/nuttx/pci/pci.h:559:65: note: expected ‘uintptr_t’ {aka ‘long unsigned int’} but argument is of >
  559 | int pci_bus_write_io_dword(FAR struct pci_bus_s *bus, uintptr_t where,
      |                                                       ~~~~~~~~~~^~~~~

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-10-09 23:32:58 +08:00
wangyongrong
8e799ff823 rpmsg: upgrade API passing on parameters with the upgrade of OpenAMP
All the rpmsg transport layer and rpmsg services sync the API
with new OpenAMP

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-10-09 23:32:58 +08:00
zhangshengchao
e26a01d9a6 regulator:add bypass logic when registering
do not control regulators when set bypass flag

Signed-off-by: zhangshengchao <zhangshengchao@xiaomi.com>
2024-10-09 23:31:49 +08:00
yinshengkai
3271142b87 note: print without relying on format strings
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-09 22:23:29 +08:00
yinshengkai
b5cf4310cb gote: implement asynchronous printf formatting
Do not format immediately when calling sched_note_printf, but delay formatting until dump trace.
After turning on SYSTEM_NOTE, similar asynchronous syslog functions can be achieved.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-09 22:23:29 +08:00
liwenxiang1
fa48d9e972 drivers/timers:Arch_alarm and arch_timer add up_ndelay interface
Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2024-10-09 22:11:03 +08:00
fangzhenwei
a6f8730c51 local_sock: fix accept use-after-free
we should get next waiter before acceptor released

Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
2024-10-09 18:16:01 +08:00
anjiahao
e007ace00d gdbstub:support only use gdbstub when panic
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-09 15:41:48 +08:00
fangxinyong
76508d42a9 sched: export sched_getcpu API in AMP mode
Some app with same code runs on different cores in AMP mode,
need known physical core id on which the function is called.

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2024-10-09 15:21:25 +08:00
ligd
fc73dfd368 sleep: optimize sleep logic, to reduce the disable IRQ time
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-09 13:54:29 +08:00
Bowen Wang
acbe19d744 pci_drivers: move qemu edu and test device header content to pci_drivers.h
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-09 13:52:01 +08:00
Xiang Xiao
6493022047 netlink: Remove the dead code in netlink_close
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-09 12:38:54 +08:00
Xiang Xiao
06d5fe6b33 netlink: Format and algin netlink.h
refactor only, no functional change.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-09 12:38:54 +08:00
hujun5
17ca45e8a3 sim: fix sim smp boot regression
This commit fixes the regression from https://github.com/apache/nuttx/pull/13716

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-10-09 12:33:21 +08:00
Xiang Xiao
b068e2357a circbuf: Move from mm/circbuf to libs/libc/misc
so that it can be used by userspace program.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-09 08:41:49 +08:00
xuxingliang
bc5a337a58 sched/note: add note for wdog module
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-10-09 08:39:58 +08:00
wangxiaoxin
8c36784aba Modify SIOCGCANSTATE/ SIOCSCANSTATE ioctl num
Notes:
Duplicate with other ioctl numbers

Signed-off-by: wangxiaoxin <wangxiaoxin@xiaomi.com>
2024-10-09 08:39:14 +08:00
wangxiaoxin
983f263ea6 add can/lin controller status
Signed-off-by: wangxiaoxin <wangxiaoxin@xiaomi.com>
2024-10-09 08:39:14 +08:00
chenzhijia
5f2bd4c655 drivers/coresight:Add TRFCR_EL1 initialization
Add TRFCR_EL1 initialization in ETM4 driver

Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2024-10-09 08:37:48 +08:00
chenzhijia
a443a37390 drivers/coresight:ETM4 setup
Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2024-10-09 08:37:48 +08:00
chenzhijia
48a5419005 drivers/coresight:Add caps member to coresight_desc_s for etr
Add caps member to coresight_desc_s for etr and fix etr compilation error

Signed-off-by: chenzhijia <chenzhijia@xiaomi.com>
2024-10-09 08:37:48 +08:00
fangpeina
b5145c528e misc/assert: add backtrace dump support for mutex hold task
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2024-10-09 08:37:01 +08:00
yinshengkai
6ce7b70a3a note: change sched_note_counter to a macro
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-09 02:51:23 +08:00
zhengyu9
323e2518d9 drivers/devicetree/fdt: get 'reg' property
Original code can only deal with single 'address & size' cell
Add function dealing with multiple 'address & size' cell
Add function getting 'bankwidth' property, for cfi-flash device

Signed-off-by: zhengyu9 <zhengyu9@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-09 02:18:49 +08:00
fangxinyong
f2cc9e8410 fs: support VFS-based named event group
This extension for the event group, to establish a connection between
named event groups and a task. The task may reference the event group
associated with a VFS-based name. Then the event group can be used
in subsequent calls to nxevent_wait() or nxevent_post().

This is an internal OS interface and should not be used by applications.

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2024-10-09 01:40:00 +08:00
ouyangxiangzhen
c0ae6525c4 sched/signal: Fix compilation errors for MSVC.
This commit removed empty struct to fix compilation errors for the MSVC compiler.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-10-09 01:36:39 +08:00
anjiahao
fb176c02ca gdb/thread.py:Remove dependence on g_current_regs
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-08 23:55:59 +08:00
buxiasen
9f2b08a91a memdump: add dump for the orphan nodes(neighbor of free node)
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-10-08 23:55:59 +08:00
buxiasen
fd9a9f67cc memdump: add biggest allocated node dump
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-10-08 23:55:59 +08:00
buxiasen
fd6634ecb5 mm/dump: make macro more common, fix help prompt
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-10-08 23:55:59 +08:00
Xu Xingliang
64e3a1fa0b libc/stream: add base64 encoded stream output
Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
2024-10-08 22:33:19 +08:00
anjiahao
4ac2a5a5ba compiler:add visibility & constructor keywords in compiler.h
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-08 19:56:33 +08:00
ligd
39bfdb95e1 timers: add goldfish timer support
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-08 15:27:33 +08:00
Xiang Xiao
77821fb7eb net: Remove IFF_DOWN flag to compatible with Linux/*BSD
turn off interface by checking IFF_UP flag isn't set:
https://github.com/apache/nuttx/issues/1838

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-08 10:15:16 +08:00
yinshengkai
bdcc325e1f sim/gcov: Fix conflicts between fprofile-orderate and __asan_default_options
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-08 08:57:28 +08:00
Bowen Wang
e83c7aba1c devicetree/fdt_virtio_mmio: implement the fdt_virtio_mmio_devices_register()
So the borad level do not need implement the
register_virtio_devices_from_fdt() again and again.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-08 08:15:00 +08:00
Philippe Leduc
80e578c9aa Fix ctypes.h locale macro 2024-10-08 08:13:42 +08:00
hujun5
31a3cea64a arch: rename xxxx_pause.c to xxxx_smpcall.c
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-10-08 08:13:22 +08:00
hujun5
d8cb7759b6 arch: remove up_cpu_pause up_cpu_resume up_cpu_paused up_cpu_pausereq
reason:
  To remove the "sync pause" and decouple the critical section from the dependency on enabling interrupts,
  after that we need to further implement "schedlock + spinlock".
changelist
  1 Modify the implementation of critical sections to no longer involve enabling interrupts or handling synchronous pause events.
  2 GIC_SMP_CPUCALL attach to pause handler to remove arch interface up_cpu_paused_restore up_cpu_paused_save
  3 Completely remove up_cpu_pause, up_cpu_resume, up_cpu_paused, and up_cpu_pausereq
  4 change up_cpu_pause_async to up_send_cpu_sgi

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-10-08 08:13:22 +08:00
ligd
5ff332f936 math: remove is_power_of_2() keep IS_POWER_OF_2()
Caused it may conflict with other platfrom

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-07 18:39:27 +08:00
xuxingliang
18d5ae20f5 drivers/segger: add heap data plot
Add heap current used to note.
Plot it in segger sysview data plot.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-07 17:34:59 +08:00
xuxingliang
eac6a8597f sched/note: add note when mm add new region
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-07 17:34:59 +08:00
xuxingliang
0663ac1483 sched/note: specify note event for heap instrumentation
1. Add NOTE_HEAP_ prefix for heap note event.
2. Use note type as heap instrumentation parameter.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-07 17:34:59 +08:00
yinshengkai
79eab8783f note: add memory tracing event support
Record all memory allocation and release, save to ram, used to analyze memory allocation rate and memory usage
Its absolute value is not trustworthy because the memory will be allocated in thread A and released in thread B

 netinit-5   [0]   0.105984392: tracing_mark_write: C|5|Heap Usage|96|free: heap: 0x606000000020 size:24, address: 0x603000000370
 netinit-5   [0]   0.105996874: tracing_mark_write: C|5|Heap Usage|24|free: heap: 0x606000000020 size:72, address: 0x6070000008e0
nsh_main-4   [0]   3.825169408: tracing_mark_write: C|4|Heap Usage|2177665|free: heap: 0x606000000020 size:424, address: 0x614000000840
nsh_main-4   [0]   3.825228525: tracing_mark_write: C|4|Heap Usage|14977|free: heap: 0x606000000020 size:2162688, address: 0x7f80a639f800
nsh_main-4   [0]   3.825298789: tracing_mark_write: C|4|Heap Usage|15189|malloc: heap: 0x606000000020 size:20, address: 0x6030000003a0

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-07 17:34:59 +08:00
ligd
553cf84a7b audio: update audio null driver
fix nxplayer can't start
support capture

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-07 13:33:34 +08:00
hujun5
f132ed2edb signal: adjust the signal processing logic to remove the judgment
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-10-07 13:32:57 +08:00
hujun5
7eea4223ee arch: move sigdeliver to common code
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-10-07 13:32:57 +08:00
Xiang Xiao
7c839d7a09 rptun: Remove include/nuttx/rptun/openamp.h
and use include/nuttx/rpmsg/rpmsg.h instead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-07 00:44:28 +08:00
Bowen Wang
280538adc6 virtio/virtio.h: add virtqueue lock api for better use
Later, we will change all virtio driver to use the new api

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-06 08:37:53 +08:00
Bowen Wang
84d2aae63b virtio-mmio: add secure virtio mmio device register api
In secure state, call virtio_register_mmio_device_secure() to
register the secure virtio mmio device;
In non-secure state, call virtio_register_mmio_device() to
register the non-secure virtio mmio device;
Board should ensure not mixed use the secure and non-seucre mmio
device.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-06 08:37:53 +08:00
anjiahao
a613bcb7cb modlib:add new dump api to modlib
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-05 15:22:02 +08:00
anjiahao
a9cb28cd23 modlib:Standardized module loading method
1. use '__attribute__((constructor))' mark initialize function
2. use '__attribute__((destructor))' mark uninitialize function
3. compile module with -fvisibility=hidden. use `__attribute__((visibility("default")))`
mark is need export symbol.so not need module_initialize to initialize export symbol.

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-05 15:22:02 +08:00
hujun5
b4cc9fb11b sched: change nxsched_islocked_global to nxsched_islocked_tcb
reason:
1 To improve efficiency, we mimic Linux's behavior where preemption disabling is only applicable to the current CPU and does not affect other CPUs.
2 In the future, we will implement "spinlock+sched_lock", and use it extensively. Under such circumstances, if preemption is still globally disabled, it will seriously impact the scheduling efficiency.
3 We have removed g_cpu_lockset and used irqcount in order to eliminate the dependency of schedlock on critical sections in the future, simplify the logic, and further enhance the performance of sched_lock.
4 We set lockcount to 1 in order to lock scheduling on all CPUs during startup, without the need to provide additional functions to disable scheduling on other CPUs.
5 Cpu1~n must wait for cpu0 to enter the idle state before enabling scheduling because it prevents CPUs1~n from competing with cpu0 for the memory manager mutex, which could cause the cpu0 idle task to enter a wait state and trigger an assert.

size nuttx
before:
   text    data     bss     dec     hex filename
 265396   51057   63646  380099   5ccc3 nuttx
after:
   text    data     bss     dec     hex filename
 265184   51057   63642  379883   5cbeb nuttx

size -216

Configuring NuttX and compile:
$ ./tools/configure.sh -l qemu-armv8a:nsh_smp
$ make
Running with qemu
$ qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic \
   -machine virt,virtualization=on,gic-version=3 \
   -net none -chardev stdio,id=con,mux=on -serial chardev:con \
   -mon chardev=con,mode=readline -kernel ./nuttx

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-10-05 13:49:55 +08:00
Alin Jerpelea
cd2fcf5252 include: 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>
2024-10-04 08:18:42 +08:00
Bowen Wang
7afbcc1a62 drivers/vhost: add vhost framework for NuttX
virtio is a framework to implement the virtio drivers
vhost (Virtual Host) is a framework to implement the virtio devices
With the virtio and vhost framework, we can use the virtio drivers
and vhost drivers to implement the cross-core communication.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-03 17:37:40 +08:00
Yongrong Wang
d0e4c4436e rpmsg_virtio: move rpmsg virtio cmd definition before the resource table
use reserved[2] in struct resource_table as the command, avoid the
resource table format do not follow the standard.

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-10-03 09:37:24 +08:00
zhaohaiyang1
534114395e char driver CAN: add tx_confirm function in upperCAN driver.
add tx_confirm function in upperCAN driver1

Signed-off-by: zhaohaiyang1 <zhaohaiyang1@xiaomi.com>
2024-10-02 21:22:07 +08:00
dongjiuzhu1
a367657d2d sched/semaphore: support recursive write for same process in sem_rw lock
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-10-02 01:56:46 +08:00
zhaohaiyang1
2ebfdf737c add the ability that control CAN transceiver state.
add the ability that control CAN transceiver state in nuttx.

Signed-off-by: zhaohaiyang1 <zhaohaiyang1@xiaomi.com>
2024-10-01 21:48:50 +08:00
zhaohaiyang1
3382752b40 nuttx/can: add can controller state setting and getting in uppercan.
add can controller state setting and getting in uppercan.

Signed-off-by: zhaohaiyang1 <zhaohaiyang1@xiaomi.com>
2024-10-01 21:48:50 +08:00
anjiahao
f2bdfa43e1 coredump:Add a coreudmp api to watch custom variables
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-01 20:40:28 +08:00
anjiahao
60796a7063 coredump:add const to memory region struct ptr
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-01 20:40:28 +08:00
zhaohaiyang1
32b25849fe chardriver upperCAN: support to independent set TX/RX FIFO size.
support to independent set TX/RX FIFO size.

Signed-off-by: zhaohaiyang1 <zhaohaiyang1@xiaomi.com>
2024-10-01 20:38:31 +08:00
xuxingliang
7044b10c88 task: use get_task_name where possible
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-10-01 20:38:06 +08:00
Jukka Laitinen
c3fd827ae1 include/sys/select.h: Define __SELECT_NUINT32 in generic way
Support defining OPEN_MAX freely to allow increasing it from 256

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-10-01 11:31:47 +08:00
buxiasen
43176bbade pm: pm_idle add support for SMP
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-09-30 20:23:11 +08:00
xuxin19
1bbcbc3440 ctype.h:move locale macro define to lib_ctype file
Macro definitions such as _S in public header files can cause compilation problems under the MSVC compiler.
Move macro definitions that are not used in public locations to the corresponding files

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-30 19:29:34 +08:00
xuxingliang
6d0180f12e assert: cleanup assert handler
1. extract dump from assert main flow
2. use OSINIT_PANIC for fatal error.
3. fix the method to judge kernel thread.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-09-30 18:43:35 +08:00
anjiahao
ee07a269af fs/ioctl:add FIOC_XIPBASE to get file xip address
in tmpfs/romfs, we can get file real xip address to execute program

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-09-30 18:25:46 +08:00
yangsong8
7d570182be usbdev: add usb APIs for polling mode
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-09-30 16:27:21 +08:00
yangsong8
b319c27f03 serial: Added APIs for receiving and sending multiple chars
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-09-30 16:27:21 +08:00
zhangkai25
bf50899637 Allocate fifosize on demand to optimize memory
Signed-off-by: zhangkai25 <zhangkai25@xiaomi.com>
2024-09-30 15:46:58 +08:00
yezhonghui
85591fc360 pci alloc mis irq support new interface
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2024-09-30 15:41:28 +08:00
dulibo1
f1fc53d7da gpio:add feature for gpio wakeup
1.add pin type to cfg gpio as wake up source
2.add IOEXPANDER_OPTION_WAKEUPCFG for set wake up option

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-09-30 08:45:37 +08:00
yangyalei
3e6ba4c17c audio: add AUDIO_MSG_IOERR msg to meida service
Signed-off-by: yangyalei <yangyalei@xiaomi.com>
2024-09-30 08:43:22 +08:00
anjiahao
29e4e71167 modlib/dlfcn:unify same code
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-09-29 15:06:54 +08:00
dongjiuzhu1
fc1aefbeb3 libc/modlib: free memory resource when rmmod elf
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-29 15:06:54 +08:00
dongjiuzhu1
1f1d90de1c 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>
2024-09-29 15:06:54 +08:00
hujun5
9de9f8168d sched: change the SMP scheduling policy from synchronous to asynchronous
reason:
Currently, if we need to schedule a task to another CPU, we have to completely halt the other CPU,
manipulate the scheduling linked list, and then resume the operation of that CPU. This process is both time-consuming and unnecessary.

During this process, both the current CPU and the target CPU are inevitably subjected to busyloop.

The improved strategy is to simply send a cross-core interrupt to the target CPU.
The current CPU continues to run while the target CPU responds to the interrupt, eliminating the certainty of a busyloop occurring.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-29 08:54:51 +08:00
hujun5
4c69bb8cc7 arch: inline up_switch_context,in arm arm64
reason:
when a context switch occurs, up_switch_context is executed.
In order to reduce the time taken for context switching,
we inline the up_switch_context function.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-28 19:08:15 +08:00
chenxiaoyi
065046b2a2 serial: use hostfs read/write on stdio as uart
This is used to implement serial console on instruction set simulator (ISS).

Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
2024-09-28 13:53:06 +08:00
yezhonghui
db19d00e64 QemuEPC support multi function for pci device
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2024-09-28 13:39:50 +08:00
Bowen Wang
0e3a96a398 include/pci.h: sync the subvendor/subdevice type in id table and pci_device_s
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-28 13:34:33 +08:00
yezhonghui
f6db814804 pci: add pci endpoint test driver
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2024-09-28 13:13:37 +08:00
yangguangcai
9a84484df5 capture:add multiple register.
Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
2024-09-28 13:11:52 +08:00
yangguangcai
fd47add2a3 capture:add CAPIOC_ALL for ioctl.
When monitoring multiple capture channels, the `ioctl` function
is called three times, leading to significant overhead mainly due
to VFS and `nxmutex_lock/unlock`. Adding a new interface can save
the overhead of two `ioctl` calls.

Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
2024-09-28 13:11:52 +08:00
makejian
5b1d910ec6 nuttx/crypto: export asynchronous calling process
Signed-off-by: makejian <makejian@xiaomi.com>
2024-09-28 13:05:28 +08:00
Bowen Wang
23a4a23397 devicetree/fdt_pci: implement the fdt_pci_ecam_register()
So the borad level do not need implement the
pci_ecam_register_from_fdt() again and again.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-28 11:51:33 +08:00
nuttxs
c0403ed768 1.xtensa/esp32s3: configure the number of universal management
(IEEE) MAC addresses when there are multipleinterfaces.
2.Optimize Lan9250 to adapt to ESP32S3 universalMAC address.
2024-09-28 11:47:24 +08:00
dulibo1
9d8991dd29 power:add BATIO_OPRTN_CHARGER_STATE for gauge sync charger state.
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2024-09-28 11:25:17 +08:00
liangdongdong
5238f2c200 feature: charge: Add battery operate
Signed-off-by: liangdongdong<liangdongdong@xiaomi.com>
2024-09-28 11:25:17 +08:00
dulibo1
797df22802 power:add default protocol for the driver which not impl get_protocol
add default protocol for the driver which not impl get_protocol

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2024-09-28 11:25:17 +08:00
yinshengkai
d888df9673 note: add ringbuffer aligned access handle
Fix ubsan warning that writes need to be aligned to memory boundaries when writing data

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-09-28 11:08:39 +08:00
dulibo1
e5e4e3030e power:add extern for public function prototypes
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-09-28 11:03:48 +08:00
dulibo1
347154c01e clk:optimized the clk_set_rate for mux
clk_mux_determine_rate->clk_get_parent_by_index

this path consume time too much

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2024-09-28 10:38:55 +08:00
yanghuatao
ae4865cf54 nuttx/timers: Fix green hills build timer.h error
"/mnt/yang/qixinwei_commit/nuttx/include/nuttx/timers/timer.h", line 257: error #223-D:
          function DEBUGASSERT declared implicitly
    DEBUGASSERT(lower->ops->tick_getstatus);

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2024-09-27 23:45:27 +08:00
guoshichao
03cabdb102 armv7-m/irq: fix the greenhills compiler compile error
CXX:  libcxxmini/libxx_new.cxx "/home/guoshichao/work_profile/vela_os/vela_qemu_1/nuttx/include/arch/armv7-m/irq.h", line 594: error #3422:
          use of the "register" storage class specifier is not allowed
    register uint32_t sp;
    ^

"/home/guoshichao/work_profile/vela_os/vela_qemu_1/nuttx/include/arch/armv7-m/irq.h", line 594: error #3422:
          use of the "register" storage class specifier is not allowed
    register uint32_t sp;
    ^

"/home/guoshichao/work_profile/vela_os/vela_qemu_1/nuttx/include/arch/armv7-m/irq.h", line 594: error #3422:
          use of the "register" storage class specifier is not allowed
    register uint32_t sp;
    ^

make[1]: *** [Makefile:69: libxx_delete_sized.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile:69: libxx_deletea_sized.o] Error 1
make[1]: *** [Makefile:69: libxx_new.o] Error 1
"/home/guoshichao/work_profile/vela_os/vela_qemu_1/nuttx/include/arch/armv7-m/irq.h", line 594: error #3422:
          use of the "register" storage class specifier is not allowed
    register uint32_t sp;
    ^

"/home/guoshichao/work_profile/vela_os/vela_qemu_1/nuttx/include/arch/armv7-m/irq.h", line 594: error #3422:
          use of the "register" storage class specifier is not allowed
    register uint32_t sp;
    ^

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-09-27 19:37:24 +08:00
yanghuatao
41d0eaa892 toolchain/ghs: Fix ?? "trigraphs not allowed" warnings
"/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/nuttx/pci/pci_regs.h", line 263: warning #1695-D:
          trigraphs not allowed
  #define  PCI_PM_CTRL_DATA_SEL_MASK        0x1e00  /* Data select (??) */
                                                                    ^

"/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/nuttx/pci/pci_regs.h", line 264: warning #1695-D:
          trigraphs not allowed
  #define  PCI_PM_CTRL_DATA_SCALE_MASK      0x6000  /* Data scale (??) */
                                                                   ^

"/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/nuttx/pci/pci_regs.h", line 266: warning #1695-D:
          trigraphs not allowed
  #define PCI_PM_PPB_EXTENSIONS             6       /* PPB support extensions (??) */
                                                                               ^

"/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/nuttx/pci/pci_regs.h", line 267: warning #1695-D:
          trigraphs not allowed
  #define  PCI_PM_PPB_B2_B3                 0x40    /* Stop clock when in D3hot (??) */
                                                                                 ^

"/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/nuttx/pci/pci_regs.h", line 268: warning #1695-D:
          trigraphs not allowed
  #define  PCI_PM_BPCC_ENABLE               0x80    /* Bus power/clock control enable (??) */
                                                                                       ^

"/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/nuttx/pci/pci_regs.h", line 269: warning #1695-D:
          trigraphs not allowed
  #define PCI_PM_DATA_REGISTER              7       /* (??) */

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2024-09-27 17:12:09 +08:00
Bowen Wang
97740fca2c include/pci_regs: add PCI_STD_NUM_BARS macro
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-27 17:12:09 +08:00
zhangkai25
bfd6185f4a add adc_receive_all just for adc_dma
Description: No longer transmitting data to fifo in a loop, complete transmission in one go

Signed-off-by: zhangkai25 <zhangkai25@xiaomi.com>
2024-09-27 14:42:45 +08:00
zhangkai25
b584b38983 add adc_fifo_size when it over 300
Signed-off-by: zhangkai25 <zhangkai25@xiaomi.com>
2024-09-27 14:42:45 +08:00
likun17
329d121d50 sensor: Added 6dof motion and gesture related types.
For details, see: https://developer.android.com/reference/android/hardware/SensorEvent#values

Signed-off-by: likun17 <likun17@xiaomi.com>
2024-09-27 13:59:41 +08:00
likun17
709cbe26f5 inlclude/uorb.h:Update data types to be sorted by macro definition.
Signed-off-by: likun17 <likun17@xiaomi.com>
2024-09-27 13:59:41 +08:00
likun17
e7e2474614 sensor:sensor info power max_range and resolution are unified with Android type.
0e67aa0cae:include_all/hardware/sensors.h

Nuttx    <-------------------------------> Android
int32_t  <-- version                   --> int
float    <-- power                     --> float
float    <-- max_range                 --> float
float    <-- resolution                --> float
int32_t  <-- min_delay                 --> int32_t
int32_t  <-- max_delay                 --> int32/64_t
uint32_t <-- fifo_reserved_event_count --> uint32_t
uint32_t <-- fifo_max_event_count      --> uint32_t
char[]   <-- name                      --> char*
char[]   <-- vendor                    --> char*

Signed-off-by: likun17 <likun17@xiaomi.com>
2024-09-27 13:59:41 +08:00
dongjiuzhu1
899eeb3c35 nuttx/uorb.h: align sensor_type value with aosp
refs:0e67aa0cae:include_all/hardware/sensors-base.h

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-27 13:59:41 +08:00
lipengfei28
0bf2c9c514 pci_epf_driver_s use FAR const struct pci_epf_ops_s *ops
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-27 10:37:31 +08:00
lipengfei28
9d425eb521 pci epc mem use virtual mem
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-27 10:37:31 +08:00
lipengfei28
aa3568f353 pci epf use epc_node link to epc
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-27 10:37:31 +08:00
lipengfei28
06a5103838 pci_epf_device_s and pci_epc_ctrl_s add priv data
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-27 10:37:31 +08:00
likun17
65264051aa stdio/va_format: move non-standard structure va_format to nuttx/streams.h
Signed-off-by: likun17 <likun17@xiaomi.com>
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-27 10:29:22 +08:00
Xiang Xiao
e105773f7e can: Merge cd_error and rx_overflow into rx_error
so the error could dispath to each client without interference

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-09-27 09:01:06 +08:00
lipengfei28
57d736b149 add epf test drv
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-27 08:52:59 +08:00
lipengfei28
56f57e5f9b add pci irq interface
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-27 00:10:19 +08:00
guoshichao
956830170d greenhills: fix the data type align build error
"/home/guoshichao/work_profile/vela_os/vela_car_5/nuttx/include/nuttx/crypto/blake2s.h", line 91: error #2118-D:
          this attribute reduces the alignment of the typedef, and while that
          will be respected for struct/field layout, the compiler will not
          generate code to handle misaligned accesses for objects of this type
  typedef uint32_t uint32_alias_t __attribute__((may_alias)) aligned_data(1);
                                                             ^

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-09-26 23:00:21 +08:00
lipengfei28
1eb151bef6 add pci_bus_map_region and pci_map_region macro
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-26 16:23:18 +08:00
wangyongrong
3b09de844f pci.h: add pci_map_bar_region support
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-09-26 16:23:18 +08:00
chao an
9abe737ef3 syslog/channel: add constant attribute if SYSLOG_IOCTL is not enabled
move all private channel define from data to rodata

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-26 16:10:29 +08:00
Bowen Wang
4bfa73f842 include/nuttx/rptun/rptun.h: change offset type to uint32_t
Sync the offset data type with resource table defined in OpenAMP
and Linux.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-26 00:04:05 +08:00
mazhuang
4fa1c460d3 rptun/rptun_ivshmem:add restart cmd to reboot slave
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>
2024-09-26 00:04:05 +08:00
Bowen Wang
dbe43b0ae9 rptun: move rptun cmd definition before the resource table
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>
2024-09-26 00:04:05 +08:00
Yongrong Wang
10e8b6c9f6 rptun/rpmsg_virtio: remove chip cmd and reuse the common ones
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>
2024-09-26 00:04:05 +08:00
Yongrong Wang
7c7d08d13a rptun.c/rpmsg_virtio.c: move panic logic from chip to rptun/rpmsg_virtio
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>
2024-09-26 00:04:05 +08:00
Bowen Wang
1a97fa73f0 rptun: rptun pm and rptun dump support cacheable memory
Should invalidate the memory when the data is located in shared
memory and write by remote core.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-26 00:04:05 +08:00
yanghuatao
520bb6544e nuttx/dirvers: Add secure rptun file
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>
2024-09-26 00:04:05 +08:00
wangyongrong
381e7f225d pci.c: add pci_read/write_io_qword support
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-09-26 00:00:03 +08:00
yangshuyong
cffcccafc2 driver/i3c: Fixed i3c pointer format to check null
Signed-off-by: yangshuyong <yangshuyong@xiaomi.com>
2024-09-24 23:36:50 +08:00
yangshuyong
9790c3d316 Added the common interface sending ccc cmd in I3C driver
Signed-off-by: yangshuyong <yangshuyong@xiaomi.com>
2024-09-24 23:36:50 +08:00
dongjiuzhu1
5b48dea4f5 drivers/i3c: support i3c driver model
Reference to: https://github.com/torvalds/linux/tree/master/drivers/i3c

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-24 23:36:50 +08:00
chao an
a5251161c6 syslog/channel: rename syslog_channel() to syslog_channel_register()
Change syslog API naming more reasonable:

1. rename syslog_channel() to syslog_channel_register()
2. rename syslog_channel_remove() to syslog_channel_unregister()

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-24 19:28:49 +08:00
chao an
8288fe4e30 Revert "toolchain/ghs: Fix CONFIG_SCHED_CRITMONITOR_MAXTIME_XXX "zero used for undefined preprocessing identifier" warnings"
move private define to public

This reverts commit 236678d730.

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-24 09:00:27 +08:00
dongjiuzhu1
90d990712d libs/libc/stdio: Optimize header file dependencies in *prinf.c file.
Signed-off-by: likun17 <likun17@xiaomi.com>
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-23 18:22:12 +08:00
dongjiuzhu1
88da2b4adb include/nuttx/compiler.h: fix redefine about offsetof
nuttx/compiler.h:176:11: warning: 'offsetof' macro redefined [-Wmacro-redefined]
          ^
clang/14.0.6/include/stddef.h:104:9: note: previous definition is here

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-23 18:22:12 +08:00
yangshuyong
a537ecdd0f Support nuttx pci endpoint driver framework
Signed-off-by: yangshuyong <yangshuyong@xiaomi.com>
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-23 10:03:54 +02:00
lipengfei28
56308bf202 bitmap: add bitmap_find_free_region
The pci ep framewoek use bitmap manage the pci outbond memory

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-23 10:03:54 +02:00
lipengfei28
ca39dc2e74 math: Optimize the implementation of log2ceil and log2floor
and move common math funtions to math32.h:
div_round_up
div_round_closest
is_power_of_2
roundup_pow_of_two
rounddown_pow_of_two

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-23 10:03:54 +02:00
lipengfei28
4fd78583f7 libc: add find_next_zero_bit
The pci ep framework use bitmap manage free bar

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-23 10:03:54 +02:00
lipengfei28
b18262d78f bits:rename __set_bit to set_bit __clear_bit to clear_bit
This used for add pci ep drver framework

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-23 10:03:54 +02:00
chenrun1
4cec713dbf fs_inode:Change the type of i_crefs to atomic_int
Summary:
  1.Modified the i_crefs from int16_t to atomic_int
  2.Modified the i_crefs add, delete, read, and initialize interfaces to atomic operations
The purpose of this change is to avoid deadlock in cross-core scenarios, where A Core blocks B Core’s request for a write operation to A Core when A Core requests a read operation to B Core.

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-09-23 14:07:03 +08:00
ouyangxiangzhen
56bcc3bb12 sched/signal: Add ifdef macro to reduce the bss size.
This commit added ifdef macro to sigwork_s. When CONFIG_SIG_EVTHREAD is
not defined, the struct sigwork_s will be empty struct, which is helpful
to reduce bss size.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-09-23 12:29:36 +08:00
wangjianyu3
515c3978dd Thermal: Check trip type in thermal_zone_device_register().
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3
d1b87bd021 Add thermal framework
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3
b78c9a7067 boardctl.h: Add BOARDIOC_SOFTRESETCAUSE_THERMAL reset cause
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
likun17
2b59a0a19b lzf: Add macro judgment to header file reference.
Signed-off-by: likun17 <likun17@xiaomi.com>
2024-09-21 03:00:13 +08:00
guoshichao
d26357d3e6 nuttx/math: fix greenhills build warning on using sizeof with operand
the detailed warning info are:
CC:  syslog/vsyslog.c "pthread/pthread_create.c", line 443: warning #1931-D: operand of sizeof is
          not a type, variable, or dereferenced pointer expression
          ptcb->cmn.timeslice = MSEC2TICK(CONFIG_RR_INTERVAL);
                                ^

CC:  dirent/lib_closedir.c "sched/sched_profil.c", line 81: warning #1931-D: operand of sizeof is not a
          type, variable, or dereferenced pointer expression
    wd_start(&prof->timer, PROFTICK, profil_timer_handler, arg);
                           ^

"sched/sched_profil.c", line 142: warning #1931-D: operand of sizeof is not a
          type, variable, or dereferenced pointer expression
    wd_start(&prof->timer, PROFTICK, profil_timer_handler, (wdparm_t)prof);
                           ^

CC:  common/arm_modifyreg8.c "sched/sched_setscheduler.c", line 165: warning #1931-D: operand of sizeof is
          not a type, variable, or dereferenced pointer expression
            tcb->timeslice  = MSEC2TICK(CONFIG_RR_INTERVAL);
                              ^

CC:  misc/lib_utsname.c "sched/sched_unlock.c", line 275: warning #1931-D: operand of sizeof is not a
          type, variable, or dereferenced pointer expression
            rtcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL);
                              ^

"sched/sched_roundrobin.c", line 119: warning #1931-D: operand of sizeof is
          not a type, variable, or dereferenced pointer expression
            tcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL);
                             ^

CC:  armv7-m/arm_fpuconfig.c cxarm: Error: No files.  Try -help.
CC:  misc/lib_crc8ccitt.c cxarm: Error: No files.  Try -help.
cxarm: Error: No files.  Try -help.
CC:  getprime_main.c cxarm: Error: No files.  Try -help.
cxarm: Error: No files.  Try -help.
CC:  misc/lib_log2ceil.c cxarm: Error: No files.  Try -help.
CC:  task/task_start.c "task/task_setup.c", line 423: warning #1931-D: operand of sizeof is not a
          type, variable, or dereferenced pointer expression
        tcb->timeslice      = MSEC2TICK(CONFIG_RR_INTERVAL);
                              ^

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-09-20 22:01:36 +08:00
likun17
71876ae098 lib_libvscanf.c:Add buffer data type conversion interface.
Signed-off-by: likun17 <likun17@xiaomi.com>
2024-09-19 11:44:47 +08:00
likun17
89a3f28a76 lib_libvsprintf.c:Add buffer data type conversion interface.
Signed-off-by: likun17 <likun17@xiaomi.com>
2024-09-19 11:44:47 +08:00
Petro Karashchenko
f0267bc507 arch/arm/samv7: add support of SocketLIN interface
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-09-19 09:39:54 +08:00
yinshengkai
f326f15b40 sched: move DUMP_ON_EXIT to sched
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-09-19 03:49:12 +08:00
wangjianyu3
ffac2a314b driver/sensors: Support GNSS Geofence
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-19 03:44:49 +08:00
wangjianyu3
bf83b3fafc driver/sensors: Support GNSS Measurement & Clock
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-19 03:44:49 +08:00
wangjianyu3
e830db0316 driver/sensors: Add constellation for GNSS
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-19 03:44:49 +08:00
wangjianyu3
c652f41c87 nuttx/uorb: Rename GPS to GNSS
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-19 03:44:49 +08:00
dongjiuzhu1
b17c074a18 nuttx/uorb: change unsigned long to uint32 to fix size issue
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-19 03:44:49 +08:00
dongjiuzhu1
403469336f driver/sensors: support sensor flush operation
Supports the flush operation of the sensor.

The application can initiate a flush action through ioctl SNIOC_FLUSH
to trigger flush, and the call will be returned immediately.
Using SNIOC_GET_EVENTS to clear flush event,

However, the flush implementation is asynchronous, when all the flush
data is push to upper circbuffer, the POLLPRI event(FLUSH_COMPLETED)
will be reported.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-19 03:44:49 +08:00
likun17
703bb7e7b3 sensor.c: Added new interface for obtaining and setting sensor device information.
When there is an actual physical sensor, the driver must implement the get info interface. The upper layer can obtain the actual physical sensor information through SNIOC_GET_INFO.
SNIOC_SET_INFO can only set the information of the local virtual sensor, which means it is bound to the local advertisement. Remote subscribers cannot set the information.

Usage:
  struct sensor_device_info dev_info;
  orb_ioctl(fd, SNIOC_GET_INFO, (unsigned long)(uintptr_t)&dev_info);

  or:
  ret = orb_set_info(fd, &dev_info);
  ret = orb_get_info(fd, &dev_info);

Signed-off-by: likun17 <likun17@xiaomi.com>
2024-09-19 03:44:49 +08:00
yanghuatao
236678d730 toolchain/ghs: Fix CONFIG_SCHED_CRITMONITOR_MAXTIME_XXX "zero used for undefined preprocessing identifier" warnings
"~/nuttx/include/nuttx/sched.h", line 631: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_SCHED_CRITMONITOR_MAXTIME_THREAD"
  #if CONFIG_SCHED_CRITMONITOR_MAXTIME_THREAD >= 0
      ^

"~/nuttx/include/nuttx/sched.h", line 637: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION"
  #if CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION >= 0
      ^

"~/nuttx/include/nuttx/sched.h", line 642: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION"
  #if CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION >= 0
      ^

"~/nuttx/include/nuttx/sched.h", line 789: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION"
  #if CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION >= 0
      ^

"~/nuttx/include/nuttx/sched.h", line 793: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION"
  #if CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION >= 0
      ^

"~/nuttx/include/nuttx/sched.h", line 631: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_SCHED_CRITMONITOR_MAXTIME_THREAD"
  #if CONFIG_SCHED_CRITMONITOR_MAXTIME_THREAD >= 0
      ^

"~/nuttx/include/nuttx/sched.h", line 637: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION"
  #if CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION >= 0
      ^

"~/nuttx/include/nuttx/sched.h", line 642: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION"
  #if CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION >= 0
      ^

"~/nuttx/include/nuttx/sched.h", line 789: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION"
  #if CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION >= 0
      ^

"~/nuttx/include/nuttx/sched.h", line 793: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION"
  #if CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION >= 0

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2024-09-19 03:16:14 +08:00
ligd
90dcd5edd3 critmonitor: add caller support
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-19 03:16:14 +08:00
yinshengkai
e28b311b78 Make each function of SCHED_CRITMONITOR independent
There will be a large performance loss after SCHED_CRITMONITOR is enabled.
By isolating thread running time-related functions, CPU load can be run with less overhead.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-09-19 03:16:14 +08:00
wangmingrong1
969a5b510e compiler.h: AVR 2-byte PC and 3-byte PC do not support returnaddress
Compilation error:
Kasan/book. c: In the function '__hwasanloaded 16_noabort':
Kasan/book. c: 76:5: Warning: 'builtin-turn_dedress' contains only 2 bytes of address
kasan_check_report(addr, size, false, return_address(0)); \
^
Kasan/book. c: 423:1: Note: in expansion of macro 'DEFINE-HWASAN_LOAD-STORE'
DEFINE_HWASAN_LOAD_STORE(16)
^
Kasan/book. c: In the function '__hwasan_store16_noabort':
Kasan/book. c: 80:5: Warning: 'builtin-turn_dedress' contains only 2 bytes of address
kasan_check_report(addr, size, true, return_address(0)); \
^
Kasan/book. c: 423:1: Note: in expansion of macro 'DEFINE-HWASAN_LOAD-STORE'
DEFINE_HWASAN_LOAD_STORE(16)
^
CC: hello. min c hello. min c: In the function 'hello. min':
Hello. main. c: 39:3: Warning: 'builtin-turn_dedress' contains only 2 bytes of address
printf("Hello, World: %p!!\n", return_address(0));

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-09-19 03:15:29 +08:00
wangmingrong1
b49eef7f4e mm/kasan: The complete implementation of inline instrumentation functions
1. Use always_inline_function instead of inline, inline does not take effect
2. Activate Kasan acceleration by 1/7

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-09-19 03:15:29 +08:00
wangmingrong1
b7d5a30f85 include/nuttx.h: add common align definitions for nuttx
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-19 03:15:29 +08:00
yinshengkai
87dc91b588 mm/kasan: add kasan watch point implementation
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-09-19 03:15:29 +08:00
yinshengkai
ae7a3d7071 mm: move kasna_start/stop to hook.c
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-09-19 03:15:29 +08:00
anjiahao
2d8b582ce6 kasan:add kasan_start/stop api to control kasan check
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-09-19 03:15:29 +08:00
yinshengkai
5ee7c563a5 mm: add kasan_unregister implementaion
In mm_uninitialize should unregister kasan

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-09-19 03:15:29 +08:00
wangmingrong
ae3facda53 kasan: Implementation of Kasan based on software tags.
Currently, only aarch64 is supported

Signed-off-by: wangmingrong <wangmingrong@xiaomi.com>
2024-09-19 03:15:29 +08:00
Xiang Xiao
9c6bed4b00 mm: Move kasan.h from mm/kasan to include/nuttx/mm
so other parts of the system can use it.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-09-19 03:15:29 +08:00
chenrun1
d04205aa3d fs/mmap/msync:support msync.
Summary:
  1.Added msync callback in struct mm_map_entry_s
  2.Added msync API in fs_msync.c
  3.Added static msync_rammap for rammap.

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-09-19 01:43:50 +08:00
Xiang Xiao
f76c2ed83b can: Add g_ prefix to can_dlc_to_len and len_to_can_dlc.
detail: Add g_ prefix to can_dlc_to_len and len_to_can_dlc to
follow NuttX coding style conventions for global symbols,
improving code readability and maintainability.

Signed-off-by: zhaohaiyang1 <zhaohaiyang1@xiaomi.com>
2024-09-18 23:50:11 +08:00
chao an
3cce16dd0c fs/dump: correct SCHED_DUMP_ON_EXIT to DUMP_ON_EXIT
1. correct SCHED_DUMP_ON_EXIT to DUMP_ON_EXIT
2. dump file list only if DUMP_ON_EXIT enabled

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-18 23:48:31 +08:00
hujun5
a2c704a84a Revert "irq: add [enter|leave]_critical_section_nonirq"
This reverts commit 1c5a0bf6cc.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-17 20:12:59 +08:00
YAMAMOTO Takashi
03b0b05c69 fs.h: fix a comment in file_operations 2024-09-17 20:11:29 +08:00
ouyangxiangzhen
5975cc9d96 signal: Make struct sigevent compatible with glibc
This patch added compatible struct sigevent definition with glibc.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-09-17 12:15:14 +08:00