Commit Graph

55024 Commits

Author SHA1 Message Date
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
lipengfei28 6e746ed364 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>
2024-09-29 13:48:24 +08:00
hujun5 d4707646d5 arch: We can use an independent SIG interrupt to handle async pause,
which can save processing time.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-29 08:54:51 +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
chenrun1 2e8e37bbf8 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>
2024-09-29 07:45:52 +08:00
hujun5 ba5091d2f7 arm64: remove the operation of clearing interrupts during GIC initialization
To align with the implementation of ARMv7-A, remove the operation of clearing
interrupts during GIC initialization to avoid losing interrupts during asynchronous startup.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-29 00:01:44 +08:00
hujun5 8f1a1006ec arm64:add busy wait flag
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-29 00:01:44 +08:00
hujun5 5e2eadacf7 arm64/smp: changing the startup of arm64 SMP from serial to parallel
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-29 00:01:44 +08:00
Huang Qi 6edbde25e5 nxstyle: Add NativeSymbol to white list
Add the new symbol `NativeSymbol` to the white list,
and update the comments about the symbols that are
from WAMR project.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-09-28 19:33:05 +08:00
yangguangcai 523b72d095 ftok:check mkdir return value.
Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
2024-09-28 19:10:31 +08:00
yintao f45eaa608d rpmsgdev: devpath may exceed RPMSG_NAME_SIZE
Signed-off-by: yintao <yintao@xiaomi.com>
2024-09-28 19:09:54 +08:00
dongjiuzhu1 190fdd18e2 misc/rpmsgdev: get battery info by rpmsgdev
read battery info register by other core

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 19:09:54 +08:00
dongjiuzhu1 22c4a82fa3 rpmsgdev:add support FIOC_FILEPATH for rpmsgdev_ioctl
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 19:09:54 +08:00
hujun5 64ebb149c6 syscall: Use a more compatible writing style
compile error:
Register: ostest
Register: nsh
Register: sh
Register: hello
Register: getprime
In file included from /home/hujun5/downloads1/vela_sim/nuttx/include/arch/irq.h:35,
                 from /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/irq.h:37,
                 from /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/sched.h:40,
                 from /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/arch.h:87,
                 from common/arm_signal_dispatch.c:26:
common/arm_signal_dispatch.c: In function 'up_signal_dispatch':
common/arm_signal_dispatch.c:72:3: error: 'asm' operand has impossible constraints
   72 |   sys_call4(SYS_signal_handler, (uintptr_t)sighand, (uintptr_t)signo,
      |   ^~~~~~~~~
make[1]: *** [Makefile:168:arm_signal_dispatch.o] error 1

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-28 19:08:15 +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
raiden00pl e7c9e46eb2 Documentation: port "Device Drivers vs. Bus Drivers and GPIO Drivers" from wiki
port page from wiki:
https://cwiki.apache.org/confluence/display/NUTTX/Device+Drivers+vs.+Bus+Drivers+and+GPIO+Drivers
2024-09-28 19:06:30 +08:00
raiden00pl 45a53f0079 Documentation: migrate pages from wiki
migrate pages:
https://cwiki.apache.org/confluence/display/NUTTX/Driver+Types
https://cwiki.apache.org/confluence/display/NUTTX/Upper+Half+and+Lower+Half+Drivers

and combine them into one page because they describe a similar topic
2024-09-28 19:06:30 +08:00
yezhonghui f81c844685 arm64 support gicv2m for pci irq
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2024-09-28 16:09:11 +08:00
wangchen 48ecb6f922 devif:fix issue about devif_callback being released wrongly,resulting in no access to it
Signed-off-by: wangchen <wangchen41@xiaomi.com>
2024-09-28 16:06:36 +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
chenxiaoyi b6225676f4 xtensa: hostfs: handle nonblock open for iss
Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
2024-09-28 13:53:06 +08:00
dongjiuzhu1 0fb1dc2b93 drivers/pipes: using rmutex to protect pipe and avoid deadlock
nxsem_wait
nuttx/sched/semaphore/sem_wait.c:176
nxmutex_lock
nuttx/libs/libc/misc/lib_mutex.c:204 (discriminator 2)
pipecommon_write
nuttx/drivers/pipes/pipe_common.c:538 (discriminator 2)
file_write
nuttx/fs/vfs/fs_write.c:91
write
nuttx/include/unistd.h:523 (discriminator 2)
nxsig_deliver
nuttx/sched/signal/sig_deliver.c:170 (discriminator 4)
arm_sigdeliver
nuttx/arch/arm/src/armv7-a/arm_sigdeliver.c:107
irq_waitlock
nuttx/sched/irq/irq_csection.c:204
nxsem_post
nuttx/sched/semaphore/sem_post.c:86 (discriminator 2)
nxmutex_unlock
nuttx/libs/libc/misc/lib_mutex.c:339 (discriminator 2)
pipecommon_poll
nuttx/drivers/pipes/pipe_common.c:769
file_poll
nuttx/fs/vfs/fs_poll.c:321
poll_fdsetup
nuttx/fs/vfs/fs_poll.c:194
poll
nuttx/include/sys/poll.h:164
uv_run
apps/system/libuv/libuv/src/unix/core.c:449
adb_hal_run
apps/system/adb/microADB/hal/hal_uv.c:76
adbd_main
apps/system/adb/adb_main.c:157
nxtask_startup
nuttx/libs/libc/sched/task_startup.c:70 (discriminator 2)
nxtask_start
nuttx/sched/task/task_start.c:134

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 13:50:21 +08:00
yezhonghui 786dabfb13 QemuEPC multi function verify for pci
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2024-09-28 13:39:50 +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
Tomashevskiy b5382234cc weact stm32h743vit6 usbconsole fix
fix previous problemc

added defconfig for weact-stm32h743:nshusb

board.h
Wrong column position or missing blank line before comment: FIX

hopefully last commit
2024-09-28 13:36:34 +08:00
Yongrong Wang fa6d41471f arm_gicv2.c: fix armv7a compile error
/vela/nuttx/drivers/pci/pci_ecam.c:432:(.text.pci_ecam_get_irq+0x16): undefined reference to `up_get_legacy_irq'

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-09-28 13:34:33 +08:00
lipengfei28 30be81add6 arm64 pci legacy irq do not support yet
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-28 13:34:33 +08:00
lipengfei28 39ec3291ee armv7a pci irq support
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-28 13:34:33 +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
Bowen Wang 6d4cab62fd pci/pci_ecam: add read_io/write_io for pci ecam
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
hujun5 f49d5f4451 armv7a/r: fix use arch-timer in SMP
reason:
Only one timer will be effective at a time.In the current
implementation of NuttX's timer handling, only a single global timer is necessary.
Having an excessive number of timers can lead to additional performance
overhead and logical errors, especially when operating in SMP
(Symmetric Multi-Processing) tickless mode.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-28 11:52:09 +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
dongjiuzhu1 b5713fd7f4 drivers/sensor: remove frequent logs
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 11:39:54 +08:00
dongjiuzhu1 d88e0eac02 drivers/sensors: Fixed the overflow problem of uint32_t subtracting large from small.
Signed-off-by: likun17 <likun17@xiaomi.com>
2024-09-28 11:39:54 +08:00
dongjiuzhu1 a5729a81e3 driver/sensors: add flags O_DIRECT to watch sensor state to avoid rpmsg work
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 11:39:54 +08:00
dongjiuzhu1 05f5517f4f drivers/sensors: clear pollpri events after get events
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 11:39:54 +08:00
dongjiuzhu1 49b650e9db drivers/sensors: avoid using sre lock between rptun thread and hpwrok
When the system cannot obtain buffers for a long time, hpwork will hold
a lot of buffers. However, due to a deadlock between the rptun thread
and hpwork, hpwork cannot send the buffers in time, causing the system
to crash.

so, avoid hold sre lock in rptun thread.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 11:39:54 +08:00
dongjiuzhu1 6b6666ee50 drivers/sensors: update nbuffer after initialization
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 11:39:54 +08:00
yintao ef9a02f51c sensors/sensor_rpmsg.c: fix list_delete node is NULL
if remote not set CONFIG_SENSOR_RPMSG, local can't receive NS_ACK
so sensor_rpmsg_device_ns_bound won't be called, not add sre->node
when local stop remote, rpmsg_deinit_vdev will call sensor_rpmsg_ns_unbind_cb
if (ept && ept->ns_unbind_cb)
	ept->ns_unbind_cb(ept);
list_delete node is NULL at sensor_rpmsg_ns_unbind_cb

Signed-off-by: yintao <yintao@xiaomi.com>
2024-09-28 11:39:54 +08:00
dongjiuzhu1 d72d9049e9 drivers/sensors: fix minor issue about sensor driver
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 11:39:54 +08:00
dongjiuzhu1 7a8d58bf1b drivers/sensors: release rpmsg resource when register_driver failed
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 11:39:54 +08:00
dongjiuzhu1 fcf2eb8fcb drivers/sesnros: fix crash because ipc buffer pointer used after free
When the ipc buffer is obtained for the first time due to insufficient space,
it waits due to insufficient ipc buffer.
At this time, if rptun recursively operates the next ipc request, the ipc buffer
will be reused, but it has been released at this time.

0  file_read (filep=filep@entry=0x20596738, buf=buf@entry=0x205d4358, nbytes=1560) at vfs/fs_read.c:86
1  sensor_rpmsg_push_event_one (dev=0x20558f70, dev@entry=0x2058fc80, stub=stub@entry=0x20596720) at sensors/sensor_rpmsg.c:799
2  sensor_rpmsg_alloc_stub (dev=dev@entry=0x2058fc80, ept=ept@entry=0x20558f08, cookie=<optimized out>) at sensors/sensor_rpmsg.c:552
3  sensor_rpmsg_sub_handler (ept=0x20558f08, data=0x204849c0, len=51, src=<optimized out>, priv=0x20558f00) at sensors/sensor_rpmsg.c:993
4  sensor_rpmsg_ept_cb (ept=<optimized out>, data=<optimized out>, len=<optimized out>, src=<optimized out>, priv=0x20558f00) at sensors/sensor_rpmsg.c:1186
5  rpmsg_virtio_rx_callback (vq=<optimized out>) at open-amp/lib/rpmsg/rpmsg_virtio.c:605
6  virtqueue_notification (vq=<optimized out>) at open-amp/lib/virtio/virtqueue.c:711
7  rproc_virtio_notified (vdev=vdev@entry=0x20558c98, notifyid=notifyid@entry=4294967295) at open-amp/lib/remoteproc/remoteproc_virtio.c:433
8  remoteproc_get_notification (rproc=rproc@entry=0x2054ff34, notifyid=notifyid@entry=4294967295) at open-amp/lib/remoteproc/remoteproc.c:1002
9  rptun_worker (arg=0x2054ff30) at rptun/rptun.c:339
10 rptun_notify_wait (rproc=<optimized out>, id=<optimized out>) at rptun/rptun.c:543
11 remoteproc_virtio_notify_wait (priv=<optimized out>, id=<optimized out>) at open-amp/lib/remoteproc/remoteproc.c:907
12 rproc_virtio_notify_wait (vdev=<optimized out>, vq=<optimized out>) at open-amp/lib/remoteproc/remoteproc_virtio.c:176
13 rpmsg_virtio_notify_wait (vq=<optimized out>, rvdev=0x2054ff78) at nuttx/include/openamp/rpmsg_virtio.h:162
14 rpmsg_virtio_get_tx_payload_buffer (rdev=0x2054ff78, len=0x20558f90, wait=<optimized out>) at open-amp/lib/rpmsg/rpmsg_virtio.c:404
15 rpmsg_get_tx_payload_buffer (ept=ept@entry=0x20558f08, len=len@entry=0x20558f90, wait=wait@entry=1) at open-amp/lib/rpmsg/rpmsg.c:207
16 sensor_rpmsg_push_event_one (dev=0x0, dev@entry=0x20590d60, stub=stub@entry=0x20596720) at sensors/sensor_rpmsg.c:783
17 sensor_rpmsg_alloc_stub (dev=dev@entry=0x20590d60, ept=ept@entry=0x20558f08, cookie=<optimized out>) at sensors/sensor_rpmsg.c:552
18 sensor_rpmsg_sub_handler (ept=0x20558f08, data=0x20483700, len=49, src=<optimized out>, priv=0x20558f00) at sensors/sensor_rpmsg.c:993
19 sensor_rpmsg_ept_cb (ept=<optimized out>, data=<optimized out>, len=<optimized out>, src=<optimized out>, priv=0x20558f00) at sensors/sensor_rpmsg.c:1186
20 rpmsg_virtio_rx_callback (vq=<optimized out>) at open-amp/lib/rpmsg/rpmsg_virtio.c:605
21 virtqueue_notification (vq=<optimized out>) at open-amp/lib/virtio/virtqueue.c:711
22 rproc_virtio_notified (vdev=vdev@entry=0x20558c98, notifyid=notifyid@entry=4294967295) at open-amp/lib/remoteproc/remoteproc_virtio.c:433
23 remoteproc_get_notification (rproc=0x2054ff34, rproc, notifyid=notifyid@entry=4294967295)
24 rptun_worker (arg=0x2054ff30) at rptun/rptun.c:339
25 rptun_thread (argc=<optimized out>, argv=<optimized out>) at rptun/rptun.c:375

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 11:39:54 +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 5a796dfbff power: fix BQ27426 driver compile error
power/battery/bq27426.c:331:17: error: ‘BATTERY_UNKNOWN’ undeclared (first use in this function)
  331 |       *status = BATTERY_UNKNOWN;
      |                 ^~~~~~~~~~~~~~~
power/battery/bq27426.c:331:17: note: each undeclared identifier is reported only once for each function it appears in
Makefile:108: recipe for target 'bq27426.o' failed

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-09-28 11:25:17 +08:00