Commit graph

62673 commits

Author SHA1 Message Date
guanyi3
31041f84ea drivers/devfreq: fix qos_get_value returning wrong min/max aggregation
QOS_REQ_MIN should return the highest value among all min requests
(most restrictive lower bound), but plist_first returns the lowest.
QOS_REQ_MAX should return the lowest value among all max requests
(most restrictive upper bound), but plist_last returns the highest.

This caused qos constraints to be ineffective. For example, two
requests (32, 208000) and (104000, 104000) would merge to (32, 208000)
instead of the correct (104000, 104000).

Fix by using plist_last for QOS_REQ_MIN and plist_first for QOS_REQ_MAX.

Signed-off-by: guanyi3 <guanyi3@xiaomi.com>
2026-08-08 15:23:54 -03:00
guanyi3
674e5ef4d8 drivers/devfreq: use hardware frequency instead of cached value in driver_target
The cached devfreq->cur may become stale when the hardware frequency is
changed externally (e.g. by another core or governor). This causes
driver_target to incorrectly skip frequency transitions when the target
matches the cached value but differs from the actual hardware frequency.

Use driver->get_frequency() to read the real hardware frequency for the
unchanged check, and sync devfreq->cur on match to keep the cache correct.

Signed-off-by: guanyi3 <guanyi3@xiaomi.com>
2026-08-08 15:23:54 -03:00
guanyi3
414694b780 devfreq/ondemand: fix use-after-free in ondemand worker
When devfreq_gov_ondemand_stop() is called from idle task context,
work_cancel() is used instead of work_cancel_sync(), which does not
wait for the currently running worker to complete. If
devfreq_gov_ondemand_exit() then frees governor_data, the worker
may still be accessing it, causing a use-after-free crash.

Fix this by:
- Nullifying dev->governor_data under dev->lock in exit before freeing.
- Moving the governor_data read inside dev->lock in the worker and
  adding a NULL check to bail out early if data has been freed.

Signed-off-by: guanyi3 <guanyi3@xiaomi.com>
2026-08-08 15:23:54 -03:00
guanyi3
77cb20f041 drivers/devfreq: add conflict_policy to devfreq_driver_s
When multiple QoS requests have no overlapping frequency range (min > max), the previous behavior always clamped to the lower frequency. Add a conflict_policy field to devfreq_driver_s so callers can choose between DEVFREQ_CONFLICT_PREFER_HIGH (default, choose higher freq) and DEVFREQ_CONFLICT_PREFER_LOW (choose lower freq) at registration.

Signed-off-by: guanyi3 <guanyi3@xiaomi.com>
2026-08-08 15:23:54 -03:00
guanyi3
7a1c62911d devfreq/procfs: add write support for frequency QoS constraints
Add the ability to set frequency constraints via procfs write.
Supported formats:
  echo <min>,<max> > /proc/devfreq/<name>  - set frequency range
  echo 0,0 > /proc/devfreq/<name>          - remove constraint

The QoS request is bound to the devfreq device lifetime so that
shell commands like echo (which open, write, close immediately)
work correctly. Leading whitespace in the write buffer is skipped
to handle extra writes from nsh echo (e.g. trailing newline).

Also add write permissions in devfreq_stat() and a procfs_qos
field in devfreq_s guarded by CONFIG_DEVFREQ_PROCFS.

Signed-off-by: guanyi3 <guanyi3@xiaomi.com>
(cherry picked from commit 70ae195c84f35a4d0b85fcc14187989b60fc0280)
2026-08-08 15:23:54 -03:00
guanyi3
ecd64e04c0 drivers/devfreq: replace mutex to spinlock
we may call devfreq_find_by_name() in pm_callback, and shouldn't call nxmutex_lock() in idle_loop, so replace mutex to spinlock.

Signed-off-by: guanyi3 <guanyi3@xiaomi.com>
2026-08-08 15:23:54 -03:00
guanyi3
072cae5193 drivers/devfreq: ondemand should init governor_data before use it
devfreq_qos_add_request -> devfreq_refresh_limit -> devfreq_limit_governor -> devfreq_gov_ondemand_limit, here use governor_data but it's 0x0

Signed-off-by: guanyi3 <guanyi3@xiaomi.com>
2026-08-08 15:23:54 -03:00
guanyi3
4f6a0bd36c drivers/devfreq: add ondemand governor
Add devfreq ondemand governor that scales device frequency based on CPU load. When CPU load exceeds the configured threshold, frequency is set to maximum; otherwise it is scaled proportionally.

Signed-off-by: guanyi3 <guanyi3@xiaomi.com>
2026-08-08 15:23:54 -03:00
guanyi3
20cb512617 drivers/devfreq: add const to devfreq_governor_s and devfreq_driver_s
we do not hope the governor and driver in devfreq to be modified.

Signed-off-by: guanyi3 <guanyi3@xiaomi.com>
2026-08-08 15:23:54 -03:00
guanyi3
1e2f9745cb drivers/devfreq: remove default governor
It's better not to use global governor, as modifying one device will cause all devices' governor to be modified.

Signed-off-by: guanyi3 <guanyi3@xiaomi.com>
2026-08-08 15:23:54 -03:00
guanyi
827b455f68 driver/devfreq: add procfs for devfreq
> ls /proc/devfreq
 /proc/devfreq:
 test_devfreq
> cat /proc/devfreq/test_devfreq
 devfreq:     test_devfreq
 governor:    test_devfreq_governor
 cur_freq:    500
 suspended:   False
 freq_table:  100 300 500 700 900
 qos_list(min, max, backtrace):
 195, 829, 0x4007c26 0x40a0e0e 0x405c706 0x4011186 0x4010dca 0x42777cc 0x4062f7e 0x409da6a

Signed-off-by: guanyi <guanyi@xiaomi.com>
2026-08-08 15:23:54 -03:00
guanyi
e29a7bcb07 driver/devfreq: DVFS framework for devices
This commit introduces a devfreq framework to manage device frequency
scaling. The framework includes the following features:
1.devfreq governor
  - provide governor ops, including init, start, stop, exit
  - default governor, performance & powersave
  - customized governor, device can provide governor when register
2.runtime register and unregister
  - device can runtime register & unregister, search by name
3.suspend and resume
  - suspend and resume frequency scaling
4.notify
  - register & unregister notifier callback, notify frequency changes
5.qos support
  - simplified QoS, manage multiple freq range request
  - including init, add/remove/update request, get value

Signed-off-by: guanyi <guanyi@xiaomi.com>
2026-08-08 15:23:54 -03:00
Justin Hammond
875e86bd35 syslog/ramlog: Survive writes made before the OS is ready.
The RAM log is the natural home for boot messages, yet writing to it
during early boot could crash the system it was meant to describe.
ramlog_addbuf took the critical section on every write, and
enter_critical_section consults the current task; on ports whose
first syslog output happens before the task lists exist, that lookup
walks uninitialized state and faults.  The notification path was
worse still, locking a scheduler that did not exist yet.

Guard both.  Before the task lists exist, plain interrupt masking
protects the buffer just as well, since there is only one thread of
control; and readers are only notified once there is an operating
system to notify them through.  The bytes land in the buffer either
way, so nothing logged before the OS is ready is lost.

Found on the EIC7700X port, which logs from its start routine before
the MMU is up: enabling RAMLOG_SYSLOG there turned the boot into a
silent wedge two characters in.  With this change the same
configuration boots and `dmesg` replays the full early history.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Justin Hammond <justin@dynam.ac>
2026-08-08 15:20:54 -03:00
Justin Hammond
d95d8c0fb1 usbhost: Report each device as it is enumerated.
A host that enumerates a device says nothing about it unless the whole of
CONFIG_DEBUG_USB_INFO is on, and then it says a great deal else besides.
The quietest case is the one that matters most: a device no class driver
claims produces no output at all, so a user with an unsupported device
sees exactly what a user with no device sees.

Add CONFIG_USBHOST_ANNOUNCE, reporting each device once, in the shape a
reader is likely to recognise from other systems: where it is, what it is,
its vendor, product and release, and the maker, product and serial number
it reports in its own string descriptors.  Those cost a control transfer
each, so they are read only where a report was asked for, and only once
the device is addressed.

The report is made after binding rather than from within it, because a
composite device never reaches the class lookup: usbhost_composite() is
tried first and binds it.  Whether a driver claimed the device is tracked
rather than read from the returned status, which the per interface loop
sets to OK whatever happened.

The port is given as the path from the root hub, and the path names the
bus, because a device on the first port of a hub and one on the first port
of a controller are otherwise reported identically.  struct
usbhost_roothubport_s gains that bus number for the purpose; a driver that
does not set it reports zero, which is the only bus it has.

Class codes are translated where a name is more use than a number, which
includes the HID boot protocols, so a keyboard is reported as a keyboard.

Default n, so no existing configuration changes.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Justin Hammond <justin@dynam.ac>
2026-08-09 02:09:47 +08:00
raiden00pl
58d1d9f9d6 drivers/usbdev/cdcacm: serialize the TX ring drain with the class spinlock
cdcacm_sndpacket() runs from task context and from the bulk IN
completion callback, which may be interrupt context.  cdcuart_dmasend()
advances the xmit tail non-atomically, so a completion arriving mid
setup re-sends the same region and advances the tail past the head,
re-transmitting a ring of stale data.

c497c5feb0 dropped the critical section that used to cover this.
Restore it with priv->lock held across the setup and EP_SUBMIT; the
submit must stay inside to keep request order.  cdcuart_dmasend() now
runs with the lock held, so its own acquisition is removed.

The race needs the writer to keep the ring non-empty across
completions, so it only appears at high sustained write rates.  On
nRF52840, 131072-byte writes were received as ~147600 bytes - one extra
CDCACM_TXBUFSIZE of stale data per hit.  With this change the host
receives exactly what was sent.

Assisted-by: Claude Code
Signed-off-by: raiden00pl <raiden00@railab.me>
2026-08-09 02:04:26 +08:00
Lwazi Dube
60abe4744f arch/mips/jz4780: Add hardware Random Number Generator (RNG) support
Add support for the hardware Random Number Generator (RNG) module found
on the Ingenic JZ4780 SoC.

Changes include:
- Update jz4780 chip.h with power management controllor base
  address JZPMC_BASE and register offsets for the RNG registers.
- A new file jz4780_rng.c to provide character driver interfaces
  for `/dev/random` and `/dev/urandom` utilizing the hardware
  RNG block.

Signed-off-by: Lwazi Dube <lwazeh@gmail.com>
2026-08-08 15:03:44 -03:00
Justin Hammond
cda33ae4fc libs/libc/netdb: Size an answer header by its header, not by its union.
dns_recv_response() checked for room using sizeof(struct dns_answer_s),
but that structure is the 10-byte header plus a union holding the largest
address it can carry.  With IPv6 built the union is 16 bytes, so the check
demanded 26 bytes where 10 were needed, and any answer sitting at the end
of a response was rejected as truncated.

An A record answer supplies 14 bytes, so whether a lookup worked depended
on how much padding the server happened to send after it:

  $ dig +noedns @10.1.1.2 github.com A      # ANSWER 1, AUTHORITY 0, ADDITIONAL 0
  -> answer is last in the packet, 14 bytes remain, rejected

  $ dig +noedns @10.11.5.254 github.com A   # ANSWER 1, AUTHORITY 13, ADDITIONAL 7
  -> 26+ bytes remain, accepted

On the board, before and after, against the first of those servers:

  nsh> nslookup apache.org
  [CPU1] dns_recv_response: DNS answer header truncated
  Host: apache.org Addr: 2a04:4e42::644                 <- A record lost

  nsh> nslookup apache.org
  Host: apache.org Addr: 2a04:4e42::644
  Host: apache.org Addr: 151.101.2.132                  <- both returned

The address that follows the header is already bounds checked separately,
where its real length is known, so only the header check was wrong.  The
size is now a named constant next to the structure, since the rest of this
function already used the literal 10 for the same quantity.

Only IPv4-only builds escaped it, where sizeof happens to equal 14 and an
A record fits exactly.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Justin Hammond <justin@dynam.ac>
2026-08-08 15:02:15 -03:00
Justin Hammond
27ff1e74e1 sched/signal: Unblock sigtimedwait through kernel memory.
nxsig_timedwait parked a pointer to the caller's siginfo buffer in the
TCB, for whoever eventually posts the signal to fill in.  But the
poster fills it in from its own context (another task, a kernel
thread, an interrupt), and in a kernel build the caller's buffer is
an address in the caller's private address space, which the poster
does not share.  The write lands wherever the currently active
mappings put it: the waiter wakes to find garbage where the signal
number should be, and some other process is left with a corrupted
page.  Flat builds share one address space, which is why this never
showed there.

Park the stack local in the TCB instead.  That is kernel memory,
mapped in every context, and it is copied out to the caller's buffer
after waking, in the caller's own context, exactly where the
pending-signal path already does the same thing.

Found on the EIC7700X port by an RTC alarm: the alarm signal, posted
from the low-priority work queue, woke a sigwaitinfo caller into an
assertion on the unblocking signal number while the init process,
whose address space had received the stray write, died of a jump to
address zero.  With this change the same test arms, waits and wakes
cleanly, repeatedly.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Justin Hammond <justin@dynam.ac>
2026-08-08 14:59:21 -03:00
raiden00pl
0b3848ef6b arch/nrf52: add SAADC continuous sampling mode
Add CONFIG_NRF52_SAADC_CONTINUOUS for gapless timer-triggered sampling
with double-buffered EasyDMA. The SAADC is auto-restarted directly from
the END event through a PPI channel (no CPU in the loop) and each
completed buffer is delivered to the ADC upper half via the batch
interface. Enables high-rate single-channel streaming.

Signed-off-by: raiden00pl <raiden00@railab.me>
Assisted-by: Claude Code
2026-08-08 14:56:52 -03:00
Justin Hammond
8279a7e755 drivers/usbhost: Refuse to register the same class driver twice.
The registry is a singly linked list of static structures, so registering
one of them a second time does not add a second entry: it points that
entry's own link at itself, and the list stops having an end.

Nothing notices while every device that turns up matches something near
the head, because the search returns before it reaches the loop.  The
first device that matches nothing at all, meaning anything without a
class driver built in, walks the list to look for it and never comes back,
holding the registry lock.  On a multiprocessor the rest of the system
follows it down: every other processor that touches the registry spins,
and on the one measured here that included the console, so a board with a
USB keyboard and no keyboard driver came up and then answered nothing.

Registering twice is easy to do by accident.  drivers_initialize() calls
usbhost_drivers_initialize(), which registers every class the
configuration selected, and board code that also registers one, which
many boards do, gets a second call for free.

So look before linking, and treat a repeat registration as the no-op the
caller expected it to be.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Justin Hammond <justin@dynam.ac>
2026-08-08 14:55:34 -03:00
Justin Hammond
dd1b57577c drivers/usbhost: Correct the xHCI controller name in a trace string.
The control transfer trace entry names the controller "HXCI", so a log of
an enumeration reads as though a different controller were involved.  One
neighbouring entry also spells the port "RHport" where the rest of the
table spells it "RHPort".

Text only.  No trace identifier or argument changes.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Justin Hammond <justin@dynam.ac>
2026-08-08 14:55:00 -03:00
Justin Hammond
4e7703792f drivers/usbhost: Define the xHCI endpoint-allocation trace.
The xHCI driver traces endpoint allocation with XHCI_VTRACE2_EPALLOC, but
that id is in neither the enumeration nor the string table, so the driver
does not compile once verbose tracing is turned on:

  usbhost_xhci_pci.c:3285: 'XHCI_VTRACE2_EPALLOC' undeclared

It builds today only because usbhost_vtrace2() collapses to a macro that
discards its arguments unless HAVE_USBHOST_TRACE_VERBOSE is defined, which
is what stops anyone finding this until they go looking for a trace.

Add the id and the string to match, keeping the two tables in step.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Justin Hammond <justin@dynam.ac>
2026-08-08 14:55:00 -03:00
raiden00pl
a4e2723ea6 boards/nrf53/thingy53: configure XOSC32MCAP
configure XOSC32MCAP for thingy53 XTAL

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-08-08 14:43:09 -03:00
raiden00pl
24a50121f2 arch/nrf53: add HFCLK XTAL oscillator support
add HFCLK XTAL oscillator support

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-08-08 14:43:09 -03:00
raiden00pl
903f393546 arch/nrf53: add DCDC regulator support
add DCDC regulator support

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-08-08 14:42:32 -03:00
raiden00pl
cf1d2f69b1 boards/nrf53: fix BLE HCI initialization for app core
After simplifications in NuttX init process, app core boots too fast so that
net core doesn't have time to initialize HCI service.

Let's add a short sleep before BLE initialization in app core as a temporary
fix, in the future it should be done better.

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-08-08 14:41:35 -03:00
Justin Hammond
50f93a986a drivers/usbhost: Register the partitions on a mass storage device.
A drive that has been anywhere near another operating system almost
always carries a partition table rather than a filesystem starting at
sector zero, so the single block device this driver registers is usually
the one thing nobody can mount.  A USB stick written with an installer
image is a good example: sector zero holds a protective MBR, and what
somebody wants is the EFI system partition several gigabytes in.

Read the table and give each partition a block device of its own beside
the whole drive, named the way every other system names them.  The
parsing is already in the tree and understands both MBR and GPT; this
only calls it and registers what it finds.

The whole-drive node stays exactly where it was, for anyone who wants
the raw thing or whose drive really does hold a bare filesystem.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Justin Hammond <justin@dynam.ac>
2026-08-08 14:40:52 -03:00
raiden00pl
f1565aa5a0 arch/nrf53/nrf53_i2c.c: fix I2C3 base
Some checks are pending
Build Documentation / build-html (push) Waiting to run
MemBrowse Memory Report / changes-filter (push) Waiting to run
MemBrowse Memory Report / load-targets (push) Waiting to run
MemBrowse Memory Report / identical (push) Blocked by required conditions
MemBrowse Memory Report / analyze (push) Blocked by required conditions
fix I2C3 base

Signed-off-by: raiden00pl <raiden00@railab.me>
2026-08-08 13:26:18 +02:00
raiden00pl
744fbd0a92 drivers/analog: add MCP445X potentiometer support
Add a lower-half driver for the Microchip MCP4451 quad digital
potentiometer. Wiper and terminal control access is provided through
the common potentiometer interface, raw register access through
chip-specific ioctl commands.

Signed-off-by: raiden00pl <raiden00@railab.me>
Assisted-by: Claude Code
2026-08-08 18:37:08 +08:00
raiden00pl
80a04ea953 drivers/analog: add digital potentiometer driver support
Add a common upper-half character driver for digital potentiometers
with a generic set of ioctl commands (wiper set/get, terminal control,
device properties) that can be shared by chip-specific lower halves.

Signed-off-by: raiden00pl <raiden00@railab.me>
Assisted-by: Claude Code
2026-08-08 18:37:08 +08:00
raiden00pl
bf905d242e syscall: add missing memory locking and clock_getres entries
add missing syscall entries for mlock, mlockall, munlock, munlockall,
mprotect and clock_getres

Signed-off-by: raiden00pl <raiden00@railab.me>
Assisted-by: Claude Code
2026-08-08 18:19:27 +08:00
Justin Hammond
8f23897d03 fs/fat: Restore the no-short-name marker when the name will not shorten.
fat_path2dirname() marks a parsed name as needing long file name
entries by clearing the first byte of the short name buffer, and
fat_dirnamewrite() writes the long name entries only while that marker
survives.  Since commit bc9e1ffb01, a name short enough to fit the 8.3
form is speculatively re-parsed as a short name, and the re-parse
fills the short name buffer with spaces before it examines a single
character.  When it then rejects the name (lower case, for example) the
spaces stay behind, the marker is gone, and the file is created with
eleven spaces for a name: no long name entries, a blank alias.

Every such file aliases to every other, since every rejected name
converts to the same blank entry.  Create a.txt, then create big1, and
both names now open one file; a directory of them lists as a single
nameless entry.  Any application that writes two lowercase short-named
files and reads the first back gets the second's contents.

Restore the marker when the speculative parse fails.

Tested on FAT32 with CONFIG_FAT_LFN: lower case, upper case, mixed
case and over-length names now create distinct, correctly named
entries that survive unmount and reboot; upper case 8.3 names still
produce plain short entries with no long name chain.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Justin Hammond <justin@dynam.ac>
2026-08-08 10:05:43 +02:00
Filipe Cavalcanti
ef06fc9e80 Documentation: update esp32p4-tab5 with LCD and touch info
Some checks are pending
Build Documentation / build-html (push) Waiting to run
MemBrowse Memory Report / changes-filter (push) Waiting to run
MemBrowse Memory Report / load-targets (push) Waiting to run
MemBrowse Memory Report / identical (push) Blocked by required conditions
MemBrowse Memory Report / analyze (push) Blocked by required conditions
Adds documentation entries to the tab5 board, mentioning the new
defconfigs and updates support features.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
2026-08-07 19:13:42 -04:00
Filipe Cavalcanti
70df5519cc boards/risc-v: add LVGL examples on esp32p4-tab5
Adds two examples on esp32p4-tab5 that use LCD and touchscreen.
Both redirect the serial console to UART0 instead of USB.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
2026-08-07 19:13:42 -04:00
Filipe Cavalcanti
e67b8c171e board/risc-v: touchscreen support on esp32p4-tab5
Adds support for ST7123 touchscreen controller on esp32p4-tab5.
Includes new KConfig option and additions to hmi_power source.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
2026-08-07 19:13:42 -04:00
Filipe Cavalcanti
2bf531b3f4 boards/risc-v: LCD support on esp32p4-tab5
Adds support for st7121 and st7123 variants for LCD support
on the esp32p4-tab5 board. Includes power management though IO
expander under 'hmi_power' and new board KConfig options.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
2026-08-07 19:13:42 -04:00
Filipe Cavalcanti
8b73477c5e boards/risc-v: support pio4ioe IO Expander on esp32p4-tab5
Adds support for bringup of the two IO Expanders available on the
esp32p4-tab5 board. Those IO Expanders allow for control of many
peripherals such as radio, camera, display and touch.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
2026-08-07 19:13:42 -04:00
Filipe Cavalcanti
5434dc9da5 arch/risc-v: MIPI-DSI support for Espressif devices
Adds lowerhalf MIPI DSI driver for RISC-V Espressif devices,
including KConfig options for LDO and MIPI_DSI.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
2026-08-07 19:13:42 -04:00
Felipe Moura
d1418d9420 drivers/usbdev/cdcacm: fix self-deadlock in cdcuart_txempty()
cdcuart_txempty() held priv->lock across EP_POLL(), which re-enters the
class through cdcacm_wrcomplete() and takes that same non-recursive lock,
and then took it a second time to read nwrq. Release it after the
disconnected check, matching cdcuart_txready()/cdcuart_rxavailable().

Fixes: cc067ab199 ("drivers/usbdev/cdcacm.c: Use small lock to protect cdcacm")
Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
2026-08-07 19:11:27 -04:00
ywhkkx
1ceda8c02f fs/pseudofile: fix buffer sizing and sparse growth.
Some checks are pending
MemBrowse Memory Report / changes-filter (push) Waiting to run
MemBrowse Memory Report / load-targets (push) Waiting to run
MemBrowse Memory Report / identical (push) Blocked by required conditions
MemBrowse Memory Report / analyze (push) Blocked by required conditions
Grow the in-memory pseudofile buffer by doubling instead of
1<<LOG2_CEIL, which can under-allocate on 32-bit targets for large
expand sizes. Also:
* reject size_t wrap before expand on write (-EFBIG)
* clear newly addressed bytes when the file grows
* route truncate growth through the same expand path

Impact: CONFIG_PSEUDOFS_FILE expand/write/truncate only; no API or
build-system change.

Testing: host arithmetic PoC blocked; WSL sim:pseudofile-poc
(SIM_M32+KASAN) write returns -ENOMEM instead of SIGSEGV in memcpy.

Signed-off-by: ywhkkx <2076064543@qq.com>
2026-08-07 10:49:43 -04:00
raiden00pl
a7e0bdb0d8 arch/x86_64: align the user stack pointer when entering user space
Some checks are pending
MemBrowse Memory Report / changes-filter (push) Waiting to run
MemBrowse Memory Report / load-targets (push) Waiting to run
MemBrowse Memory Report / identical (push) Blocked by required conditions
MemBrowse Memory Report / analyze (push) Blocked by required conditions
The task and pthread entry points were entered with the stack pointer
left by the kernel side of the startup path, not aligned to the 16
bytes the ABI requires: applications calling a variadic function with
floating point arguments crashed with a general protection exception
on the first SSE store of the argument save area. Align the stack
pointer when returning to user space, where the value is known.

Signed-off-by: raiden00pl <raiden00@railab.me>
Assisted-by: Claude Code
2026-08-07 09:34:30 -03:00
Felipe Moura
a1b9bedbe4 arch/[risc-v|xtensa]/espressif: reconnect Wi-Fi STA on AP-side disconnect
The disconnect handler only reconnects when the reported reason is
WIFI_REASON_ASSOC_LEAVE, so an AP-initiated deauth (beacon timeout, auth or
assoc expire) leaves the station down forever.  Restore the intent flag the
driver used before 1f7c3a32e5 and 20ff68bd65, matching the ESP-IDF rule of
reconnecting unless the disconnection was requested locally.

Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
2026-08-07 09:18:45 -03:00
raiden00pl
b0182d3c0e arch/nrf5x: fix USBD data OUT packet loss when no read request is queued
A packet received while the request queue was empty was silently dropped
and the transfer deadlocked. Hold it in the endpoint buffer until the
class driver submits a read request.

Signed-off-by: raiden00pl <raiden00@railab.me>
Assisted-by: Claude Code
2026-08-07 18:50:36 +08:00
raiden00pl
5eeb0ae939 arch/nrf5x: fix USBD data IN back-to-back packet loss
A data IN endpoint has a single hardware buffer, but the driver armed
the next packet before the host had read the previous one, silently
overwriting it and dropping data under sustained bulk IN traffic. Track
an armed-packet-in-flight state per endpoint (epinflight) and defer
re-arming until the host read completes (EPDATASTATUS), sending the next
packet from nrf52_epdatainterrupt(). Also release the DMA lock right
after the busy-wait for ENDEPIN on data endpoints so other endpoints do
not stall on an interrupt round-trip.

Signed-off-by: raiden00pl <raiden00@railab.me>
Assisted-by: Claude Code
2026-08-07 18:50:36 +08:00
zhekunren
8a0f354ac6 net/igmp: fix checksum validation that always dropped valid IGMP packets
igmp_input() validated the IGMP checksum with:

  if (net_chksum((FAR uint16_t *)igmp, IGMP_HDRLEN) != 0)

but net_chksum() returns the raw one's complement sum of the 16-bit
words (it does NOT take the one's complement of that sum). For a valid
IGMP packet whose checksum field holds ~S (as written by igmp_send()),
the sum of all 16-bit words is S + ~S = 0xffff, never 0.

So the existing check `!= 0` was always true for any well-formed IGMP
message, sending every valid packet down the "Checksum error" path to
be silently dropped and breaking IGMP membership query/report processing.

Compare against 0xffff instead, matching the convention used by the
other transport input handlers:

  - ipv4_input.c: (ipv4_chksum(IPv4BUF) != 0xffff)
  - tcp_input.c:  (tcp_chksum(dev) != 0xffff)

This is also consistent with the sender side in igmp_send.c, which
stores `igmp->chksum = ~igmp_chksum(...)`.

Signed-off-by: zhekunren <zhekunren@qq.com>
Assisted-by: GLM-5.2 <noreply@z.ai>
2026-08-07 16:36:42 +08:00
Lwazi Dube
72796cdcd7 docs/boards/ci20: Remove redundant mkimage command
Some checks are pending
Build Documentation / build-html (push) Waiting to run
MemBrowse Memory Report / changes-filter (push) Waiting to run
MemBrowse Memory Report / load-targets (push) Waiting to run
MemBrowse Memory Report / identical (push) Blocked by required conditions
MemBrowse Memory Report / analyze (push) Blocked by required conditions
Remove the manual mkimage step because CONFIG_UBOOT_UIMAGE=y already
generates a valid uImage. This brings the documentation up to date
with the uImage usage that was already standard in practice.
2026-08-07 11:17:55 +08:00
Alin Jerpelea
f6b6f20791 boards/arm/stm32f3/nucleo-f302r8: fix qenco configuration
build will fail with the following error
arm-none-eabi-ld: /awork/android/NuttX/nuttx/nuttx section flash'
arm-none-eabi-ld: region .text' will not fit in region flash' overflowed by 1144 bytes

before
Register: qe
Register: nsh
Register: sh
LD: nuttx
arm-none-eabi-ld: /awork/android/NuttX/nuttx/nuttx section .text will not fit in region flash
arm-none-eabi-ld: region flash overflowed by 1144 bytes
Memory region         Used Size  Region Size  %age Used
           flash:       66680 B        64 KB    101.75%
            sram:        5136 B        16 KB     31.35%
make[1]: *** [Makefile:230: nuttx] Error 1
make: *** [tools/Unix.mk:569: nuttx] Error 2

after
Register: qe
Register: nsh
Register: sh
LD: nuttx
Memory region         Used Size  Region Size  %age Used
           flash:       38008 B        64 KB     58.00%
            sram:        4132 B        16 KB     25.22%
CP: nuttx.hex
CP: nuttx.bin

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2026-08-07 11:17:24 +08:00
Felipe Moura
f9a25a4fef boards/esp32c3-devkit: add Dropbear SSH server support
Some checks are pending
Build Documentation / build-html (push) Waiting to run
MemBrowse Memory Report / changes-filter (push) Waiting to run
MemBrowse Memory Report / load-targets (push) Waiting to run
MemBrowse Memory Report / identical (push) Blocked by required conditions
MemBrowse Memory Report / analyze (push) Blocked by required conditions
Restore the esp32c3-devkit:dropbear defconfig and its documentation, now that
the AES symbol collision between the Wi-Fi stack and crypto/aes.c is fixed in
the ESP HAL.  netutils/dropbear depends on CRYPTO_CRYPTODEV_SOFTWARE_CRYPTO,
so the defconfig enables the cryptodev software backend and base64 codecs.

Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
2026-08-06 16:15:12 -03:00
Felipe Moura
d55f9d8c41 arch/risc-v/espressif: update ESP HAL to prefix wpa_supplicant AES symbols
The HAL's wpa_supplicant defines aes_encrypt()/aes_decrypt(), which collide
at link time with the same symbols from crypto/aes.c whenever a Wi-Fi
configuration also enables CRYPTO_CRYPTODEV_SOFTWARE_CRYPTO.  Bump the HAL to
the revision that prefixes them on NuttX (espressif/esp-hal-3rdparty#13).

Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
2026-08-06 16:15:12 -03:00
Filipe Cavalcanti
fb84ca4e4e arch/risc-v: fix uninitialized HW cmds and bus clock
Initialize i2c_ll_hw_cmd_t in sendstart/startrecv so ack_exp/done are
not left with stack garbage that can NACK or skip the address byte.
Program i2c_hal_set_bus_timing() with the requested bus_freq instead of
the board default so msg frequency is applied.

Affects only Espressif devices.

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
2026-08-07 00:49:36 +08:00