Commit Graph

8 Commits

Author SHA1 Message Date
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