Commit Graph

55396 Commits

Author SHA1 Message Date
wangming9 00857c7fd9 arm/qemu: The PSCI can be configured with CONFIG_ARM_PSCI
Signed-off-by: wangming9 <wangming9@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-07 17:33:14 +08:00
ligd 4818707870 glodfish: add SMP boot support
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-07 17:33:14 +08:00
ligd d1bcc1f504 qemu: simply SMP boot
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-07 17:33:14 +08:00
ligd 86a1cc30a5 task: merge nxtask_setup_name() before create_stack
After this patch up_create_stack() can do some
judgement with thread name

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-07 15:47:13 +08:00
Lup Yuen Lee 3173746e5d CI: Refactor the Build Rules based on Arch Labels
This PR continues to enhance the CI Workflow, to skip the unnecessary NuttX Builds. The changes in this PR will not take effect until the next PR, which will switch `build.yml` to use the rules in this PR.

In this PR, we refactor the CI Build Rules into a separate Reusable Workflow `arch.yml`. The original rules were migrated to `arch.yml`:
- We target only the Simple PRs: One Arch Label + One Size Label (e.g. "Arch: risc-v, Size: XS")
- For "Arch: risc-v": Build `risc-v-01`, `risc-v-02`
- For "Arch: xtensa": 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

New and Updated Rules:
- For "Arch: arm": Build `arm-01`, `arm-02`, ...
- For "Arch: arm64": Build `other`
- For "Arch: simulator": Build `sim-01`, `sim-02`
- For "Arch: x86_64": Build `other`
- For Simple PRs (One Arch Label + One Size Label): Skip the macOS and Windows builds (`macos`, `macos/sim-*`, `msys2`) since these builds are costly and slow
- Except for "Arch: Simulator", which will enable the macOS Builds for `sim-01` and `sim-02`
- If GitHub CLI Fails: Build all targets

The code is explained here: https://github.com/apache/nuttx/issues/13775
2024-10-07 15:04:28 +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 f12996c851 sched: replace sync pause with async pause for nxsig_process
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-10-07 13:32:57 +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
buxiasen a569eef6ba arch: cpu pause when sigaction only necessary if tcb running
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-10-07 13:32:57 +08:00
yuanyongjian 6869a05368 syslog/syslog_rpmsg.c: the last log may be lost when it crashes
At line 236, we may set the null terminate to the priv->buffer,
when flushing the priv->buffer, we should use up_putc() instead up_nputs()
to ensure all the data has been output, because up_nputs() will check
the null terminate but up_putc() not.

Signed-off-by: yuanyongjian <yuanyongjian@xiaomi.com>
2024-10-07 12:18:10 +08:00
yuanyongjian 9e1750d22c syslog/syslog_rpmsg.c: out of memory
Signed-off-by: yuanyongjian <yuanyongjian@xiaomi.com>
2024-10-07 12:18:10 +08:00
ligd 7567e429b6 syslog_rpmsg: fix coding style
Follow the nxstyle

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-07 12:18:10 +08:00
yuanyongjian 8713638687 syslog/syslog_rpmsg.c: improve syslog_rpmsg performance
use copy buffer instead of single assignment

Signed-off-by: yuanyongjian <yuanyongjian@xiaomi.com>
2024-10-07 12:18:10 +08:00
Xiang Xiao 6e5c81e061 mm/heap: hold heap lock before access mm_nregions
to remove the race condition and rename IDX to idx

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-07 04:19:27 +08:00
Yongrong Wang 365fed554e rpmsgblk.c: fix compile warning
misc/rpmsgblk.c:616:29: warning: implicit declaration of function ‘rpmsg_virtio_get_buffer_size’; did you mean ‘rpmsg_get_rx_buffer_size’? [-Wimplicit-function-declaration]
  616 |   if (MAX(msglen, rsplen) > rpmsg_virtio_get_buffer_size(priv->ept.rdev))
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                             rpmsg_get_rx_buffer_size

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-10-07 04:18:18 +08:00
Kyle Wilson ac15155fc9 Enable LPUART functionality for the STM32G4 series.
1. Kconfig - Removed USART1 config option from STM32_STM32G47XX. Not necessary to adding LPUART functionality. 2. stm32_lowput.c - Added extra check from STM32G4 board because that is the only with LPUART functionality. 2. stm32_serial.c - Removed unneeded function (stm32_serial_get_lpuart). Fixed up_putc return bug. Added configuration for DMAMAP_LPUART RX and TX for STM32G4XXX only. The G4 is the only in this family with LPUART and uses a DMAMUX unlike the others.

1. Removed 1WIRE LPUART refereences in Kconfig and stm32_uart.h. There is no support for LPUART currently in stm32_1wire.c. 2. Removed references to LPUART under DMA_V2 ifdefs. STM32G4 uses DMA_V1, and I saw that none of the chips DMA_V2 (F20, F4) have LPUARTs. AFAIK the only chip in the stm32 folder that has LPUART peripherals is the STM32G4.

Removed unnecessary brackets and empty lines

Added lpuartnsh (LPUART NuttShell) config to the nucleo-g474re board configurations. nsh uses USART3 by default. lpuartnsh uses nsh as a template, changes the serial console to LPUART1, and adds the DMA configs to enable DMA for the LPUART.

Added support for using the lpuart prescaler register. Without prescaling the apbclock, 9600 baud is not supported on the G474RE. By utilizing the prescaler, when necessary, we can support nearly any baud rate (300 baud to 30M Mbaud). lowputc defaults to a prescaler of 16 for the lpuart so standard baud rates (9600 to 115200) are supported early in the boot process. Later in stm32_serial.c the ideal prescaler and BRR values are determined.

Added ifdef statements for LPUART code sections not compatible with other chips.

Changed LPUART BRR calcuation to use 64-bit integers.

Feedback from nuttx pull request. Added brackets around single line if/else statements. Reordered lpuartnsh defconfig file.

Fix lpuart brr calculation after attempting to break the calculation into 2 lines.

Removed TAB
2024-10-07 04:14:59 +08:00
cuiziwei 97359a7f76 nuttx/libxx: Simplify compilation warnings for passing CXXFLAGS.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-07 00:46:45 +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
hujun5 eae57cb0e6 sched: replace sync pause with async pause for nxtask_terminate
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)

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-10-06 09:26:56 +08:00
raiden00pl bcf309d80e arch/arm/nrf{52|53|91}: fix max timer timeout
fix prerpocessor value of max timer timeout
2024-10-06 08:39:12 +08:00
raiden00pl 500b985874 boards/arm/nrf52/nrf52840-dk: fix timer example
board logic expects TIMER2 to be enabled
2024-10-06 08:39:12 +08:00
Yongrong Wang 26ac220810 virtio devices: update virtqueue operate buffer add lock API
1. Use the virtqueue_xxx_lock() api;
2. Add spinlock for some virtio and vhost drivers that do not
   use spinlock to protect the virtqueues;

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-10-06 08:37:53 +08:00
Bowen Wang fd9efb600c virtio/virtio-net: add spinlock for the virtqueue
virtqueues are used in irq and thread, so add spinlock to protect
them.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-06 08:37:53 +08:00
Bowen Wang c0edb0f402 virtio/virtio-net: calculate the correct buffer number
Avoid exceed the virtqueue length limit when adding buffer to the
virtqueue.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-06 08:37:53 +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
wangyongrong 377f184019 virtio-rpmb.c: add spin lock for virtqueue add/get buffer
Virtqueeus are used in both user thread and interrupt, so add spinlock
to proetect them.

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-10-06 08:37:53 +08:00
wangyongrong e8a8052a8a virtio-serial.c: add spin lock for virtqueue add/get buffer
Virtqueeus are used in both user thread and interrupt, so add spinlock
to proetect them.

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-10-06 08:37:53 +08:00
wangyongrong 67ceba3cd6 virtio-blk.c: add spin lock to fix get/add virtqueue buffer at the same time err
Virtqueues are used in both user thread and interrupt, so add spinlock to protect
them.

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-10-06 08:37:53 +08:00
wangyongrong 58aca26b1b virtio-blk.c: change virtio blk req and resp to local variables
So we can remove the mutex lock to improve the virtio-block driver
performance

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-10-06 08:37:53 +08:00
wangyongrong 735dc6e2bf virtio-rng.c: add spin lock to fix get/add virtqueue buffer at the same time err
the virtqueue should be protected by the spinlock, because the virtqueues are used
both in worker and interrupt.

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-10-06 08:37:53 +08:00
wangyongrong f6f151a8e1 virtio-blk: add VIRTIO_BLK_F_BLK_SIZE feature
Support configure the virtio block device block size to other value
(default value is 512)

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-10-06 08:37:53 +08:00
wangyongrong ef58c71582 virtio-blk: add VIRTIO_BLK_F_RO feature
When feature VIRTIO_BLK_F_RO is set, virtio-blk only support read
operation.

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-10-06 08:37:53 +08:00
wangyongrong 7ec167392c virtio-blk: add VIRTIO_BLK_F_FLUSH features
Should support the flush command only when virtio device support
feature VIRTIO_BLK_F_FLUSH

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-10-06 08:37:53 +08:00
Bowen Wang 7eda1700c2 virtio/virtio-rng: make virtio-rng work for remoteproc transport layer
For remoteproc transport layer, the virtio drivers can not use the malloced
memory from the default system heap to communicate with the virtio devices,
the buffers placed in virtqueue should be in the share memory region
(mallcoed virtio_alloc_buf()).

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-06 08:37:53 +08:00
Bowen Wang 106040df6c virtio-serial: support custom the virtio serial device name
By setting config CONFIG_DRIVERS_VIRTIO_SERIAL_NAME to "ttyXX0;ttyXX1;..."
to customize the virtio serial name.

For example:
If CONFIG_DRIVERS_VIRTIO_SERIAL_NAME="ttyBT;ttyTest0;ttyTest1",
virtio-serial will register three uart devices with names:
"/dev/ttyBT", "/dev/ttyTest0", "/dev/ttyTest1" to the VFS.

nsh> ls dev
/dev:
 console
 null
 telnet
 ttyBT
 ttyS0
 ttyTest0
 ttyTest1
 zero

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
shipei 551b9b1626 audio:add getlatency for virtio snd driver
add getlatency in virtio snd driver

Signed-off-by: shipei <shipei@xiaomi.com>
2024-10-06 08:37:53 +08:00
raiden00pl 50f21f93d4 boards/arm/stm32f0l0g0/stm32g071b-disco: fix djoy example
fix djoy example for stm32g071b-disco.
CONFIG_NSH_ARCHINIT=y must be set to register djoy.
2024-10-05 17:29:16 -03:00
raiden00pl 65a3b5f524 arch/arm/nrf{52|53|91}: fix read GPIO state for outputs
when GPIO is configured as output, we have to read output
state instead of input register
2024-10-05 23:40:34 +08:00
raiden00pl e3bbd0cfd8 drivers/serial/CMakeLists.txt: add missing files
add missing files: uart_bth5.c and uart_ram.c
2024-10-05 23:40:11 +08:00
Xiang Xiao 1195ec03f7 driver/vhost: Call metal_init in vhost_register_drivers
since libmetal come from OpenAMP need be initialized before working

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-05 12:05:13 -03:00
Xiang Xiao f914bc8ef2 driver/vhost: Check driver is NULL before calling probe
to avoid the same device bind to multiple drivers at the same time

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-05 12:05:13 -03:00
Xiang Xiao 1e823a077c driver/vhost: vhost_register_device should set priv before inovking probe
align the behavior with vhost_register_driver

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-05 12:05:13 -03:00
Xiang Xiao 347c2dae29 driver/virtio: Check driver isn't NULL before calling remove
since the device mayn't bind to the driver yet

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-05 12:05:13 -03:00
Xiang Xiao bad1627759 driver/vhost: Check driver isn't NULL before calling remove
since the device mayn't bind to the driver yet

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-05 12:05:13 -03:00
Xiang Xiao 0f918c8d4d pci/ivshmem: Check drv isn't NULL before calling remove
since the device mayn't bind to the driver yet

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-05 12:05:13 -03:00
Xiang Xiao 2aaaa7632f rpmsg/ivshmem: Skip unregistering ivshmem driver
since ivshmem device may insert again

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-05 12:05:13 -03:00
Xiang Xiao 6685fb5434 pci/ivshmem: Skip unregistering ivshmem driver
since ivshmem device may insert again

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-05 12:05:13 -03:00
chenrun1 8f9857bf8c fs_lock:Check the nwaiter when deleting a bucket
Summary:
  Fixed the problem of releasing the bucket prematurely in multi-threaded flock scenarios.

A thread setlk
B thread setlk_wait
A thread releases lock but fails to determine if nwaiter causes the bucket to be released prematurely
post B thread causes crash due to heap use after free

https://github.com/apache/nuttx/issues/13821

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-10-05 21:09:46 +08:00