1976 Commits
Author SHA1 Message Date
boa-z bd6c9fbfc9 [cherryusb][ehci] Fix missing SETUP buffer cache clean
Backport cherry-embedded/CherryUSB@41f5796:
https://github.com/cherry-embedded/CherryUSB/commit/41f57964cc442145099250f0190eb71e9d1d9d5a

The fix is already merged in CherryUSB upstream but is not included in
the v1.6.1 copy integrated in RT-Thread.  The EHCI port cleans qTD/QH
descriptors and the transfer buffer for DMA, but not the SETUP packet,
so on a non-coherent platform the controller can read a stale packet and
a device may never enumerate.

Apply the upstream change: clean the SETUP buffer in ehci_qh_add_head()
before the QH is linked into the asynchronous or periodic list.
2026-11-09 10:30:27 +08:00
Chen Moushun 37d8b8d1d0 drivers/spi: QEMU virtual SPI loopback bus for utest (#11972) (#11979)
* drivers/spi: add QEMU virtual SPI loopback bus for utest (#11972)

Register a pure-software SPI bus (default name spi2) with memcpy
loopback xfer so components.drivers.spi.loopback passes on
qemu-vexpress-a9 without a PL022 model. Fix utest include/CPPPATH
and align Kconfig/rtconfig bus name.

Verified: scons + qemu utest_run components.drivers.spi.loopback PASSED.

Fixes #11972 (SPI/QEMU checklist item).

* drivers/spi: fix clang-format violations in spi_virt_bus.c

Fix the 'Check File Format and License' CI job failure:

- put the spi_virt_ops initializer brace on the assignment line
- add the missing newline at end of file

No functional change.

* drivers/spi: separate virt bus Kconfig from loopback utest (#11972)

Add a dedicated, default-off RT_UTEST_SPI_VIRT_BUS switch (default name
spi_virt) so enabling RT_UTEST_SPI_LOOPBACK no longer compiles or
registers a software SPI bus. Hardware loopback now always runs on the
real controller named by RT_UTEST_SPI_LOOPBACK_BUS_NAME, while QEMU/CI
targets opt in to the virtual bus explicitly.

Also move the utest enablement out of the qemu-vexpress-a9 BSP defaults
and into ci.attachconfig as peripheral.SPI_VIRT_LOOPBACK.

* cla: empty commit to retrigger license/cla check (#11979)

* ci(utest): add A9 SPI loopback virt bus config (#11979)

* [drivers][spi] gate virtual SPI bus utest on !RT_USING_DM

RT_UTEST_SPI_VIRT_BUS compiles spi_virt_bus.c, which registers a software
loopback bus with rt_spi_bus_register(). That path needs no device tree
node, so on a BSP that enables RT_USING_DM and RT_USING_OFW the
registration fails with -RT_EINVAL when no matching DT node exists.

Add "depends on !RT_USING_DM" to the option and document in help that it
is only available without the device model and must stay disabled on DM
based BSPs. spi_virt_bus.c is already fully wrapped in
#ifdef RT_UTEST_SPI_VIRT_BUS, so no C change is needed.

The A9 utest config (bsp/qemu-vexpress-a9) has RT_USING_DM disabled, and
.github/utest/configs/components/spi.cfg still enables both the virt bus
and the loopback test with bus name "spi_virt", so CI coverage is kept.

Refs #11972
2026-11-08 14:48:35 +08:00
CYFS 16d725e578 [utest][can] Add CAN send and receive tests (#11752)
* [utest][can] Add CAN send and receive tests

* [utest][can] Fix external CAN FD receive timeout

Check the no-progress timeout after duplicate or unmatched frames, and
only wait on the receive semaphore when no complete frame is available.
Exit immediately once all expected patterns have been received.

Format the test with the current mainline configuration and clang-format
22.1.8.

Validation: reproduced the original duplicate/unmatched-frame hang with
a 50-tick timeout and a 1000-tick watchdog. All 22 host-stub scenarios pass,
including timeout renewal, tick wraparound, empty reads, error propagation,
and successful reception. The mainline formatting check also passes.
No full BSP build or hardware test was performed.
2026-11-06 09:45:46 +08:00
CYFS 905e4832bf [UTEST][SDIO] Add block device read and write test (#11758)
* [UTEST][SDIO] Add block device read and write test

* [UTEST][SDIO] Fix change log author

* [utest][sdio] Format block read and write test

Align macros and continuation indentation using the current mainline
configuration and clang-format 22.1.8.

Validation: the mainline formatting check and git diff --check pass.
Verified that all changes are whitespace-only.
2026-11-06 09:44:49 +08:00
hanzhijian 67861fa4fd [drivers][virtio] Fix RX buffer leak on pbuf allocation failure 2026-11-05 18:30:59 +08:00
Old-Ding e2e507c499 drivers: fix CFI MTD array bounds checks (#11558)
* drivers: fix CFI MTD array bounds checks

Generated-by: OpenAI Codex
Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>

* drivers: reject truncated CFI erase geometry

A truncated erase-region table leaves the full flash size registered
with only part of its sector geometry. Fail probing instead of exposing a
device whose erase address lookup can select the wrong sector.

Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>

* drivers: fix CFI log indentation

Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>

---------

Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
2026-11-05 18:30:26 +08:00
liangzhan5 7feb0edadb [components][ofw]fix: add depth limit check for fdt_unflatten to prevent stack flow #11901 2026-11-05 16:05:45 +08:00
seteiro 5a385acca1 utest/watchdog: tolerate timeout quantize and non-stoppable close (#11446) 2026-11-05 15:52:18 +08:00
seteiroandGrok 6e7f9e3a37 [utest][watchdog] Add watchdog smoke test for #11446
Add components.drivers.watchdog.smoke covering device find/open and
timeout set/get. Optional start/keepalive/stop stays off by default
to avoid board reset when STOP is unsupported.

Co-Authored-By: Grok <seteiro@mail.grokbot.com>
2026-11-05 15:52:18 +08:00
usualtreee 964dd80240 [drivers][nvme] Fix inactive namespace allocation leaks (#11920)
Allocate namespace devices only after validation and release them on registration failure.
2026-11-05 14:11:03 +08:00
usualtreee bd99153931 [utest][i2c] 增加 I2C 框架模拟总线测试 (#11982)
覆盖消息转发、10 位地址、错误传播、锁释放和收发返回值。
2026-11-05 11:18:32 +08:00
usualtreee 54862ee1e8 [utest][dac] 增加 DAC 框架模拟设备测试 (#11976)
覆盖设备注册、通道控制、数据写入、错误传播及重复执行。
2026-11-05 11:18:17 +08:00
Chen Moushun 7b0edb4979 [drivers][ipc] 校验 pipe ioctl 用户指针 (#11971)
在用户态 ioctl 路径验证目标地址并检查回拷长度。
2026-11-05 11:18:03 +08:00
usualtreee 3277e831bf [drivers][graphic] 拒绝非法帧缓冲偏移 (#11970)
在读写长度计算前拒绝负偏移和缓冲区外偏移。
2026-11-05 11:17:49 +08:00
Zhang Yuyang b5de39d977 [drivers][virtio] 修复 RPMsg 探测错误及 NS 资源泄漏 (#11968)
传播 NS 分配错误,并在注册失败和卸载路径释放资源。
2026-11-05 11:17:34 +08:00
陈泽堂 0aae54ae97 [drivers][serial] 保留共享串口的接收回调 (#11931)
仅在最后一个使用者关闭串口时清理接收回调。
2026-11-05 11:16:53 +08:00
Bernard Xiong b47754d44b [sdio] 在块配置完成后设置块大小 (#11886)
使用块设备配置完成后的实际块大小初始化存储参数。
2026-11-05 11:15:36 +08:00
Bernard Xiong f6857f9fb0 [DM/PCI] Validate MSI-X table BIR and offset against BAR (#11986)
* [DM/PCI] Validate MSI-X table BIR and offset against BAR

BIR and the table offset in the MSI-X capability are controlled by the
device. msix_table_remap() used BIR directly as an index into
pdev->resource[] and never checked the table against the BAR size, so a
malicious device could make the kernel map and write to an arbitrary
physical address during probe.

Reject out-of-range BIR values, unassigned or zero-sized BARs, and
tables that do not fit completely inside the assigned BAR. Also verify
that the requested vector count does not exceed the table size read
from the MSI-X control register.

Fixes #11985

* [DM/PCI] Fix cppcheck warnings in MSI-X code

- Restore the default IRQ only when an MSI descriptor exists, avoiding
  a potential NULL pointer dereference in rt_pci_msi_shutdown
- Initialize the error code in msix_setup_msi_descs so that an empty
  vector list returns a defined value
2026-11-05 10:47:23 +08:00
Bernard Xiong d3a368d565 [drivers][serial] improve TIOCGWINSZ and termios updates #11891 2026-11-04 21:33:18 +08:00
bernardandDeepSeek 4.1 Flash d59285201a [drivers][block] reject GPT entries with ending_lba before starting_lba
is_pte_valid() accepted a GPT entry as long as both LBAs were inside the
disk, so a crafted image could set ending_lba < starting_lba. The size
computed in efi_partition() then underflowed to a huge value and was
registered as the logical partition size.

Reject entries whose end LBA is below the start LBA, and compute the
partition start/size only after the entry passed validation. This avoids
evaluating the underflow at all and reuses the validated start value for
the size calculation.

Fixes RT-Thread/rt-thread#11271.

Co-authored-by: DeepSeek 4.1 Flash <noreply@deepseek.com>
2026-11-04 21:30:29 +08:00
GuEe-GUI 2c88a3b698 [drivers][scmi] Fix reset provider lookup and driver registration order
- register SCMI reset and power-domain drivers during subsystem initialization
- resolve SCMI reset state through the reset-controller provider
- use the parsed DT reset domain ID when querying reset attributes
- retain the SCMI device reference in the reset provider instance

Signed-off-by: GuEe-GUI <2991707448@qq.com>
2026-11-02 18:20:45 +08:00
zhangyangysuandyang.zhang 7e7237d644 Fix stack corruption in rt_sdhci_init_host() (#11542)
* lwp: fix pid leak on exec failure before task startup

When msh tries to execute a non-ELF path, lwp_execve() may allocate a PID
before lwp_load() fails. The old error path only dropped the LWP reference,
leaving the PID tree entry pointing to a freed LWP.

In an init-less boot flow, this can poison pid 1 after a failed command from
msh. A later LWP launch may then treat the stale pid 1 entry as a valid parent
LWP, resulting in invalid pgrp/session state and a job-control assertion during
process exit.

Add lwp_pid_rollback() for exec/spawn failures before the process becomes
runnable. Unlike lwp_pid_put(), it always releases the PID lock and does not
enter the "no more pid allocation" state when the PID tree becomes empty.

Use the rollback helper in lwp_execve() failure paths after PID allocation.

Signed-off-by: zhangyang <gaoshanliukou@163.com>

* [drivers][sdio] avoid SDHCI device name stack overflow

rt_sdhci_init_host() allocated a fixed 32-byte buffer for device-derived object names, but sdio_host_set_name() may copy up to RT_NAME_MAX bytes into the output buffer. When RT_NAME_MAX is larger than 32, this can overwrite the stack and corrupt nearby locals.

Size the temporary name buffer with RT_NAME_MAX, force it to be NUL-terminated, and derive the append offset from the actual string length. Also replace the suffix rt_sprintf() calls with bounded rt_snprintf() so timer and workqueue suffixes cannot overflow the buffer when the base name is already close to RT_NAME_MAX.

Signed-off-by: zhangyangysu <zhangyangysu0928@gmail.com>

---------

Signed-off-by: zhangyang <gaoshanliukou@163.com>
Signed-off-by: zhangyangysu <zhangyangysu0928@gmail.com>
Co-authored-by: yang.zhang <zhangyang01@kylinos.cn>
2026-11-02 11:24:11 +08:00
Bernard Xiong b88861d285 [bsp][qemu-virt64] enable RT-Thread Smart #11896 2026-10-29 09:29:21 +08:00
bernard e6905134d5 [drivers][8250] honor register width for ns16550 earlycon
- read reg-shift and reg-io-width from the device tree
- select the MMIO access width from reg-io-width
- reject unsupported register widths during early setup
- keep the generic 8250 path for other compatibles
2026-10-27 19:26:35 +08:00
GUI 1c801efabc [bsp][spacemit/k1] first version #11132 2026-10-19 18:49:16 +08:00
seteiroandGrok 54f5cac5b4 drivers/misc: register rt_null at BOARD init for default console (#11472)
rt_console_set_device() is typically called in rt_hw_board_init() right
after rt_components_board_init(). null was INIT_DEVICE (level 3), so it
was not registered yet and could not be RT_CONSOLE_DEVICE_NAME.

Raise to INIT_BOARD_EXPORT; null is a pure software sink with no HW deps.

Co-Authored-By: Grok <seteiro@mail.grokbot.com>
2026-10-19 16:53:09 +08:00
zhangyuyang 8159dc81b7 [drivers][touch] Remove redundant path from global CPPPATH
The touch framework has no private headers in its source directory, so
adding the directory to CPPPATH is unnecessary. Remove it to avoid
polluting the global header search path, as discussed in #10980.
2026-10-17 16:42:48 +08:00
GUIandseteiro 8d8dc96b67 [ARCH/RISC-V] Next RISC-V (#10320)
* [libcpu][risc-v] Refactor the RISC-V architecture port

Introduce an opt-in unified RISC-V common layer for RV32 and RV64 while keeping existing BSPs on the legacy implementation during migration.

- use ARCH_RISCV and ARCH_CPU_64BIT for architecture and XLEN selection
- unify context, trap, MMU, cache, timer, SBI, SMP and ISA handling
- add PLIC, CLIC, ACLINT, APLIC and IMSIC support
- map physical hart IDs to contiguous logical CPU IDs
- add T-Head vendor overrides while preserving legacy ports
- migrate qemu-virt64-riscv with RV32 and RV64 support
- update clock_time, MM, LWP, OFW, PCI and Rust integration

Existing BSPs continue using legacy_common or common64 unless they select RT_USING_RISCV_NEW_COMMON.

Signed-off-by: GuEe-GUI <2991707448@qq.com>

* [libcpu][risc-v] skip disabled CPU nodes in early FDT walk

Rbb666 noted that rt_hw_fdt_install_early() walked every /cpus child
without checking status, so disabled cores still joined hart registration
and MMU capability probing. Skip nodes that are not okay/ok via
rt_fdt_device_is_available() before reading reg or mmu-type.

Signed-off-by: seteiro <chenmoushun@163.com>

* [libcpu][risc-v] Fix per-CPU page table mapping

- reuse existing non-leaf page table entries when mapping per-CPU areas
- reject leaf entry conflicts instead of overwriting mappings

Signed-off-by: GuEe-GUI <2991707448@qq.com>

---------

Signed-off-by: GuEe-GUI <2991707448@qq.com>
Signed-off-by: seteiro <chenmoushun@163.com>
Co-authored-by: seteiro <chenmoushun@163.com>
2026-10-17 09:44:26 +08:00
Huoyanlifusu 5d1fb66d13 [drivers][ofw] Fix phandle hash buffer overflow 2026-10-15 13:50:46 +08:00
rcitach 3f0c11116c [wlan] synchronize AP lifecycle and direct RX handling 2026-10-15 13:28:57 +08:00
Jiang Yu 9e0e6dbba7 [components/drivers] reset: Fix build error when reset and ulog are both enabled.
The '#define assert ASSERT' in ulog_def.h conflicts with the 'assert'
used in reset.c (rstc->rstcer->ops->assert), causing unintended macro expansion.

Signed-off-by: Jiang Yu <yu.jiang@rock-chips.com>
2026-10-14 09:16:11 +08:00
蒙蒙plus 05badce954 [drivers][ipc] 移除 SConscript 中冗余的 __RT_IPC_SOURCE__ 宏定义 2026-09-27 12:18:44 +08:00
Onlyou_tzZ 0edbc15ea9 [cherryusb][fsdev] add N32H4x USBFS device support #11764 2026-09-21 15:43:37 +08:00
zhangyuyang 5d1aee9b32 [components][sdio] Fix CIS tuple memory leak 2026-09-21 10:12:51 +08:00
zhangyuyang c2f5a28321 [components][sdio] fix possible memory leak of sdio driver unregistration 2026-09-21 09:34:06 +08:00
wdfk-prog f6e74cee17 feat[drivers][block]: fix printf format type mismatches
Fix format specifier mismatches in blk_partition.c by using the
appropriate integer formats and explicit casts.

This removes -Wformat warnings on platforms where rt_uint32_t and
rt_size_t are represented as unsigned long.
2026-09-21 09:28:56 +08:00
CYFS 280bcfeec3 [device][mmcsd] Fix Arm Compiler 5 build compatibility #11690 2026-09-07 11:18:41 +08:00
CYFS b1e8365a6a [utest][rtc] Add RTC time and alarm tests 2026-09-01 13:36:58 +08:00
CYFS 5a9d4d77e3 [utest][pwm] Fix matrix test cleanup and timeout 2026-09-01 09:33:32 +08:00
CYFS f62b0ad85d [utest][pwm] Add configurable PWM matrix test 2026-09-01 09:33:32 +08:00
bernard 21e6f363a4 [components][serial] Format termios staging declaration 2026-08-30 20:55:20 +08:00
bernard 272292f3bc [components][serial] Address review findings for ioctl hardening 2026-08-30 20:55:20 +08:00
bernard c5ead8254e [components][serial] Harden RT-Smart serial ioctl arguments
在 v1/v2 串口文件边界复制已知用户参数,补齐 v2 unread count 和 termios 缓冲区保护。

在 imx6ull UART 编程前校验波特率,并在硬件配置成功后提交串口状态。
2026-08-30 20:55:20 +08:00
bernard ebe4be9a50 [drivers][virtio] Depend VirtIO net on LWIP
将 VirtIO Net 的依赖从 RT_USING_ETHERNET 调整为 RT_USING_LWIP。
避免 SMART QEMU 在未启用以太网抽象时无法选择网卡。
2026-08-30 20:49:24 +08:00
Bernard Xiong 0305faf806 [finsh] Remove deprecated FINSH_FUNCTION_EXPORT_ALIAS#11734 2026-08-26 10:53:23 +08:00
Kai d2acd7587e wlan: fix silent failure of wifi cmd when device mode not bound#11696 2026-08-17 14:34:57 +08:00
Kai 0823a4b80c wlan: add WPA3/enterprise/WAPI/OWE/DPP security modes 2026-08-17 11:00:04 +08:00
GuEe-GUI f7258a6bb8 [bsp/raspberry-pi] update DM support
- reorganize common Raspberry Pi drivers under the device framework
- add the Raspberry Pi 5 BSP, configuration and documentation
- add BCM2712 and DesignWare AXI DMA controller support
- distinguish BCM2712 DMA32 and DMA40 channels by channel mask
- restore DesignWare AXI DMA enable bits after controller reset
- support a shared AXI maximum burst length across DMA channels

Signed-off-by: GuEe-GUI <2991707448@qq.com>
2026-08-16 19:56:03 +08:00
GUI 7bf01ae18d [DM/OFW][PCI] Fix address translation and PCI resource enumeration (#11677)
* [DM/OFW][PCI] Fix address translation and PCI resource enumeration

Rework OFW address translation to walk nested bus ranges in the correct
direction and cache "ranges" and "dma-ranges" independently. Handle PCI
three-cell addresses without treating the PCI flags cell as part of the
address, and fix CPU-to-DMA and DMA-to-CPU translation across nested
buses.

Fix PCI BAR sizing and assignment by disabling address decoding during
probing, preserving BAR attribute bits, and programming 64-bit BARs
correctly. Add device enable and disable helpers so resources and bus
mastering are enabled before driver probe.

Program bridge memory and prefetch windows while scanning downstream
buses, correctly link child buses into the PCI bus hierarchy, and avoid
unnecessary PCIe link retraining when the link is already active.

Allow host bridges without a device-tree pci-domain property by
allocating unique domains dynamically, while preserving explicit domain
assignments.

Fix MSI and MSI-X IRQ setup, rollback, vector addressing, and affinity
selection.

Add the Raspberry Pi PCI vendor ID for RP1 and other downstream devices.

Signed-off-by: GuEe-GUI <2991707448@qq.com>

* style: format code with clang-format

* style: format complete changed files with clang-format

* drivers: pci: address OFW review feedback

* style: format PCI and OFW changes for current master

---------

Signed-off-by: GuEe-GUI <2991707448@qq.com>
2026-08-14 12:42:32 +08:00
GUI f2c05253d1 [dm][dma] Update DMA (#11678)
* [dm][dma] update DMA interface

Extend DMA mapping to honor OFW dma-ranges even
when no reserved memory pool is present,
and add PCI host-bridge DMA-region translation for PCI devices.
Prefer 32-bit-addressable allocations for translated devices,
improve pool allocation fallbacks and synchronization,
and establish a linear mapping for installed DMA pools when possible.

Signed-off-by: GuEe-GUI <2991707448@qq.com>

* [dm][dma] fixup PL330 work flow

Fix PL330 channel allocation so device-tree cells
select peripheral request lines rather than execution channels.
Generate proper peripheral DMA microcode using DMAWFP, DMALDP, DMASTP, and DMAFLUSHP,
encode burst lengths correctly,
honor transfer direction and non-secure attributes,
and allocate microcode from DMA-coherent memory.

Signed-off-by: GuEe-GUI <2991707448@qq.com>

* style: format code with clang-format

* style: format complete changed files with clang-format

* drivers: dma: fix diagnostic format types

* style: format DMA changes for current master

---------

Signed-off-by: GuEe-GUI <2991707448@qq.com>
2026-08-14 12:42:01 +08:00