22 Commits

Author SHA1 Message Date
Piyush Patle 0dccc8ba21 include/debug.h: Move to include/nuttx/debug.h
debug.h is a NuttX-specific, non-POSIX header. Placing it in the
top-level include/ directory creates naming conflicts with external
projects that define their own debug.h.
This commit moves the canonical header to include/nuttx/debug.h,
following the NuttX convention for non-POSIX/non-standard headers,
and updates all in-tree references.

A backward-compatibility shim is left at include/debug.h that
emits a deprecation #warning and re-includes <nuttx/debug.h>,
allowing out-of-tree code to continue building while migrating.

Signed-off-by: Piyush Patle <piyushpatle228@gmail.com>
2026-04-07 07:50:06 -03:00
wangzhi16 2274c31950 drivers/vhost: add missing SCHED_WORKQUEUE dependency
The vhost driver uses work_queue() for deferred probe but was missing
the SCHED_WORKQUEUE Kconfig dependency, causing link errors on boards
that don't enable workqueue by default.

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2026-02-04 02:32:02 +08:00
Yongrong Wang b3314b3813 drivers/vhost: use MSEC2TICK for deferred probe period
Convert VHOST_DEFERED_PROBE_PERIOD from a raw value to use MSEC2TICK()
macro, ensuring the delay is correctly converted from milliseconds to
system ticks regardless of the configured tick rate.

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2026-02-04 02:32:02 +08:00
Yongrong Wang a286287f4e drivers/virtio and vhost: auto-select parent config from sub-drivers
Change DRIVERS_VIRTIO and DRIVERS_VHOST from menuconfig to hidden config
options. Each virtio/vhost sub-driver now automatically selects its parent
config, eliminating the need to manually enable DRIVERS_VIRTIO or
DRIVERS_VHOST in defconfig files.

This simplifies board configuration by removing redundant CONFIG_DRIVERS_VIRTIO
entries from affected defconfig files.

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-02-04 02:32:02 +08:00
Bowen Wang 2fc2f44b61 drivers/vhost: add vhost_get_vq_buffers() to collect scatter-gather buffers
Add vhost_get_vq_buffers() API to retrieve all chained buffers from a
virtqueue in one call. This simplifies handling of scatter-gather I/O
where data spans multiple descriptors.

The function populates an array of virtqueue_buf structures with buffer
pointers and lengths, returning the descriptor head index on success.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Signed-off-by: hongfengchen <hongfengchen@xiaomi.com>
2026-02-04 02:32:02 +08:00
Bowen Wang 2eaf5de3d9 drivers/vhost-rng: fix the vhost-rng compile error
1. Include the <nuttx/spinlock.h> beacause vhost-rng used spinlock
2. Remove the unused ret;

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-19 14:18:27 +08:00
Yanfeng Liu 01b308a146 drivers/vhost: fix cmake typos
This fixes filename typos in drivers/vhost/CMakeLists.txt

Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
2026-01-19 14:18:27 +08:00
Bowen Wang 4ded8df3d5 virtio and vhost-rpmsg: add virtio and vhost rpmsg device support
virtio and vhost rpmsg device as standalone device registered to
the virtio and vhost bus.

virtio-rpmsg and vhost-rpmsg use the common virtio_rpmsg_common.c
implementation in rpmsg dir.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-19 14:18:27 +08:00
Bowen Wang 44ca5d0e2b virtio/vhost: update virtqueue_get_available_buffer() api
OpenAMP already change virtqueue_get_available_buffer() to
virtqueue_get_first_avail_buffer(), so update them

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2025-12-31 02:36:29 +08:00
Lars Kruse 3ce85ca54e style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
rongyichang 39780fdae1 drivers/vhost-rng: fix compile error in vhost-rng.
vhost/vhost-rng.c:154:9: error: too few arguments to function 'virtio_create_virtqueues'
  154 |   ret = vhost_create_virtqueues(hdev, 0, 1, vqnames, callback);

Signed-off-by: rongyichang <rongyichang@xiaomi.com>
2025-01-12 00:06:12 +08:00
rongyichang ee2f3df2ff drivers/vhost: fix compile error while get vhost status.
vhost/vhost.c: In function 'vhost_status_driver_ok':
vhost/vhost.c:86:20: error: too few arguments to function 'virtio_get_status'
   86 |   uint8_t status = vhost_get_status(hdev);

Signed-off-by: rongyichang <rongyichang@xiaomi.com>
2025-01-12 00:06:12 +08:00
Alin Jerpelea 286d37026c drivers: 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-11-06 18:02:25 +08:00
Xiang Xiao 32784b0898 libc: Refine the arc4random_buf implementation
fill the buffer with getrandom instead random pool
and move the implementation to from crypto to libc

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-26 18:04:21 -03: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
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 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
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