Commit Graph

55396 Commits

Author SHA1 Message Date
Michal Lenc f778660aca smartfs: return -ENOTTY if ioctl command is not found
The upper layer expects -ENOTTY is returned if ioctl command is not
found in file system specific implementation.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2024-10-05 20:52:31 +08:00
raiden00pl fb7fe185d8 boards/sim: update foc test config
Update FOC configuration so that it doesnt fail during initialization.
2024-10-05 18:45:12 +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 5df3625b62 sched: replace sync pause with async pause for nxtask_restart
reason:
In the kernel, we are planning to remove all occurrences of up_cpu_pause as one of the steps to
simplify the implementation of critical sections. The goal is to enable spin_lock_irqsave to encapsulate critical sections,
thereby facilitating the replacement of critical sections(big lock) with smaller spin_lock_irqsave(small lock)

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 14:23:25 +08:00
hujun5 0b0f535c66 sched: replace sync pause with async pause for setpriority
reason:
In the kernel, we are planning to remove all occurrences of up_cpu_pause as one of the steps to
simplify the implementation of critical sections. The goal is to enable spin_lock_irqsave to encapsulate critical sections,
thereby facilitating the replacement of critical sections(big lock) with smaller spin_lock_irqsave(small lock)

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 14:00:59 +08:00
hujun5 8e89984360 sched: replace sync pause with async pause for nxsched_suspend
reason:
In the kernel, we are planning to remove all occurrences of up_cpu_pause as one of the steps to
simplify the implementation of critical sections. The goal is to enable spin_lock_irqsave to encapsulate critical sections,
thereby facilitating the replacement of critical sections(big lock) with smaller spin_lock_irqsave(small lock)

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:59:35 +08:00
hujun5 6a13e4a6f6 sched/sched: next pointer value is definitely not null
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-10-05 13:49:55 +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
zhanghongyu bd83d2aca5 fs_lock: fix cmake build error
nuttx/fs/vfs/fs_lock.c:39:10: fatal error: sched/sched.h: No such file or directory
   39 | #include "sched/sched.h"
      |          ^~~~~~~~~~~~~~~

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-10-05 13:43:02 +08:00
wanggang26 e16c785e8c mmcsd: move block driver register to probe stage in order to read ext_csd reg
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-10-05 09:17:25 +08:00
cuiziwei 6373931cf1 nuttx/arch: Fix the issue where the compiler cannot recognize min-pagesize=0.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-05 08:45:08 +08:00
Ville Juven 0976258299 riscv/kstack: Remove riscv_current_ksp as obsolete
Unwinding the kernel stack did not work previously due to the way the task
startup logic works via nxtask_start and the up_task_start() system call.

After modifying the logic behind those, the kernel stack is in fact fully
unwound when return_from_exception is executed, so calling the original
hack "riscv_current_ksp" is not necessary anymore.
2024-10-04 08:33:34 +08:00
Ville Juven 190a2e306c riscv/syscall: Simplify task/pthread_start logic
This removes 2 reserved system calls and replaces them with an ASM snippet.
The result removes an unnecessary ecall from the process startup logic, as
well as ensures the stacks are FULLY unwound when the user process starts.

The logic is ported from ARM64.
2024-10-04 08:33:34 +08:00
Ville Juven e9f96105dd risc-v/syscall: Simplify dispatch_syscall for RISC-V
Port the simplification from ARM64, this removes the ugly inline assembly
trampoline "do_syscall" and replaces it with a simple table lookup and
call via function pointer.
2024-10-04 08:33:34 +08:00
chenxiaoyi ba5ee1929c sim: add link option /LARGEADDRESSAWARE:NO for windows64
Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
2024-10-04 08:21:35 +08:00
chenxiaoyi b39807fae0 sim: add windows64 setjmp/longjmp support
Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
2024-10-04 08:21:35 +08:00
chenxiaoyi 56bcbcc6b0 sim: change the type of xcpt_reg_t
Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
2024-10-04 08:21:35 +08:00
chenxiaoyi c8e0f5c890 libc: fix build warning
nuttx\libs\libc\misc\lib_bitmap.c(1,1): warning C4819: The file contains a character that cannot
 be represented in the current code page (936).

Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
2024-10-04 08:21:35 +08:00
chenxiaoyi f6fc4cdded sim/irq: fix windows64 build error
nuttx\vs2022\include\arch\irq.h(144,9): error C2065: 'mov': undeclared identifier

Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
2024-10-04 08:21:35 +08:00
chenxiaoyi 43de53c93f sim/types: fix windows64 build error
nuttx\include\sys\types.h(133,22): error C2371: 'size_t': redefinition; different basic types

Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
2024-10-04 08:21:35 +08:00
chenxiaoyi 26c7f80dc6 sim: add windows64 defconfig
Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
2024-10-04 08:21:35 +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
Matteo Golin e959e0062e Create a documentation folder to list sensor drivers that are available. This way each sensor added/implemented can have its own space to define any unique ioctl commands that it uses, unique error codes and programming examples. 2024-10-03 15:36:10 -03:00
p-szafonimateusz ce61347ddf arch/x86_64/intel64/intel64_schedulesigaction.c: properly align signal handler stack for vector operations
signal handler stack must be properly aligned, otherwise vector instructions doesn't work in signal handler

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-10-03 21:07:19 +08:00
p-szafonimateusz ed4acb20cc arch/x86_64/intel64/intel64_cpuidlestack.c: stack_alloc should point to stack base not stack top
stack_alloc should point to stack base not stack top

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-10-03 21:07:19 +08:00
p-szafonimateusz 6b8d0c6a16 arch/x86_64/intel64/intel64_head.S: move initial RSP for AP cores below regs area
move initial RSP for AP cores below regs area.
otherwise IDLE thread for AP cores can be corrupted

XCP region now match regs allocation in up_initial_state()

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-10-03 21:07:19 +08:00
p-szafonimateusz 026e1b4b5e arch/intel64: colorize IDLE stack for AP cores
colorize IDLE stack for AP cores in x86_64

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-10-03 21:07:11 +08:00
p-szafonimateusz 4a6e6563cb arch/x86_64/addrenv.h: fix MMU flags for USER region
fix typo in MMU flags for USER region

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-10-03 21:06:52 +08:00
p-szafonimateusz b47839b9c2 arch/intel64: fix IRQ conflict with GOLDFISH
Also move MSI IRQ definition to place where other IRQ definitions are.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-10-03 20:55:19 +08:00
p-szafonimateusz 76bfb994a7 arch/x86_64/src/intel64: use legacy method to map memory <4GB
the new mapping method may not work when we have to map memory at the early boot stage

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-10-03 20:54:59 +08:00
Bowen Wang 51d6e8f49e virtio/vhost: assign the virtio/vhost_drvier to device->priv before probe
So the driver can get the driver pointer by vdev/hdev->priv,
and later vdev/hdev->priv can be used to store other data such as the
virtio/vhost drivers' private data.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-03 17:37:40 +08:00
Bowen Wang c42576e87b drivers/vhost-rng: add vhost rng driver support for NuttX
vhost-rng is a simple virtio device implementation, it receives
the buffer receviced from the virtio-rng driver and fill the random
number to this buffer and return to virtio-rng.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-03 17:37:40 +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
Lup Yuen Lee 089b5e07c7 build.yml: Check out the correct branch of nuttx-apps
When building a branch like `releases/12.7`, the CI Workflow incorrectly checks out the `master` branch of `nuttx-apps`, instead of `releases/12.7`. This PR fixes a typo in `apps_ref`, to check out the correct branch.
2024-10-03 14:29:12 +08:00
SPRESENSE c38b4494be arch: cxd56xx: update loader and gnssfw version
Update loader and gnssfw to version 2.2.20596
2024-10-03 14:25:09 +08:00
SPRESENSE cc6306a559 boards: cxd56xx: Fix an issue not to enter cold sleep
Fix an issue not to enter cold sleep by SD Card detection interrupt.
2024-10-03 14:24:55 +08:00
SPRESENSE fb7c429504 arch: cxd56xx: Fix gnss compile error
Fix a compile error when CONFIG_CXD56_GNSS_CEP_ON_SPIFLASH is enabled.
2024-10-03 14:24:15 +08:00
zhengyu9 70a91289dd fs: fdcheck can't assert
while running fdcheck_test_common there should be assertion failed

Signed-off-by: zhengyu9 <zhengyu9@xiaomi.com>
2024-10-03 14:22:55 +08:00
zhangyuan29 34d247fb5f group: change pthread_kill to tkill in kernel mode
Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
2024-10-03 09:39:33 +08:00
Lup Yuen Lee abe2f4baa2 build.yml: Skip the CI Builds that don't match the Arch Label
This PR proposes to enhance the CI Workflow, to skip the unnecessary NuttX Builds. Currently, NuttX Devs wait for the CI Builds to complete across All Architectures (Arm32, Arm64, RISC-V, Xtensa), even though they modified a Single Architecture. With this PR, the CI Workflow will build only the Modified Architecture.

The solution uses the Arch Labels for PRs. We target only the Simple PRs: One Arch Label + One Size Label (e.g. "Arch: risc-v, Size: XS")
- If "Arch: arm / arm64" is the only non-size label, then we build `other`, `arm-01`, `arm-02`, ...
- If "Arch: risc-v" is the only non-size label, then build `risc-v-01`, `risc-v-02`
- If "Arch: xtensa" is the only non-size label, then build `xtensa-01`, `xtensa-02`
- The above rules apply when the PR is Created or Modified
- When the PR is Merged: All targets shall be built

The code is explained here: https://github.com/apache/nuttx/issues/13775
2024-10-03 09:38:48 +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
Ville Juven 30aa947b95 arm64_fpu: Remove fpu_regs from the TCB
Since FPU is now always saved into the current process stack location
upon exception entry, there is no need to keep fpu_regs (or saved_fpu_regs)
in the TCB.
2024-10-03 09:08:26 +08:00
simbit18 b3107a1f1b tools/testbuild.sh: Improved speed in the skipping phase 2024-10-03 08:59:04 +08:00
Bowen Wang af6eb7226e drivers/rptun: add cmake support for rptun_secure
1. Add cmake support for rptun_serure;
2. Move rptun_secure.c before rptun_ivshmem.c in Make.defs to follow
   the order in Kconfig.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-03 08:57:46 +08:00
Jukka Laitinen a88693f519 drivers/usbdev/cdcacm.c: Fix compilation issues
Add #ifdef CONFIG_SERIAL_TXDMA/RXDMA in g_uartops init

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-10-03 08:55:13 +08:00
Jukka Laitinen 5d4d2cbbc8 drivers/usbdev/pl2303.c: Don't let maximum number of bytes in request exceed CONFIG_PL2303_BULKIN_REQLEN
The request length may not exceed CONFIG_PL2303_BULKIN_REQLEN, otherwise buffer overflow will occur

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-10-03 08:55:13 +08:00
Jukka Laitinen 18526d78eb drivers/usbdev/cdcacm.c: Set reqlen properly according to ep->maxpacket and CONFIG_CDCACM_BULKIN/OUT_REQLEN
The request length may not exceed CONFIG_CDCACM_BULKIN_ lenghts, otherwise buffer overflow will occur

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-10-03 08:55:13 +08:00
Jouni Ukkonen 9ea098558a 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>
2024-10-03 08:55:13 +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