And remove the virtio_alloc/free_buf implementation in virtio.c, because
these two apis has been moved to the OpenAMP
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
notify_wait has been remove in remoteproc ops and virtio_dispatch and
has been moved to the struct rpmsg_virtio_device in new OpenAMP,
so change the rptun too,
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
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>
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>
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>
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>
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>
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>
1. Some platforms do not support interrupt mode (PCI_MSI/MSIX),
so add polling mode support, so these platforms can also use virtio-pci;
2. In some cases, we do not want to use the interrupt for virtio driver
to avoid time jitter, so add the polling mode support;
3. If CONFIG_DRIVERS_VIRTIO_PCI_POLLING_PERIOD <= 0, interrupt mode.
if CONFIG_DRIVERS_VIRTIO_PCI_POLLING_PERIOD > 0, polling mode.
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
Follow the virtio spec, support the virtio pci Legacy
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
Signed-off-by: andi <andi6@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
1. only support pci modern device;
2. need the pci controller support MSI/MSI-X;
It has been verified based on virtio-rng and virtio-net.
Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Coredump need call the block read/write ops in interrupt
Not consider the ops called in thread and intterupt simultaneously.
Only used for coredump now.
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
According to Virtual I/O Spec:
When using legacy interfaces, transitional drivers which have not negotiated VIRTIO_F_ANY_LAYOUT MUST use a single descriptor for the struct virtio_net_hdr on both transmit and receive, with the network data in the following descriptors.
https://docs.oasis-open.org/virtio/virtio/v1.2/cs01/virtio-v1.2-cs01.html#x1-2280006 (Section 5.1.6.6)
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
This adds DRIVERS_VIRTIO_SERIAL_CONSOLE config and related logic to
virtio serial so that it can be used as console device. Note that
due to its dependency on OS services, this console is available late
so it is not proper for debugging too early booting issues.
Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
Use private naming to avoid conflicts with user applications
In file included from libuv/src/unix/internal.h:25,
from libuv/src/unix/udp.c:23:
libuv/src/uv-common.h:57: warning: "container_of" redefined
57 | #define container_of(ptr, type, member) \
|
In file included from nuttx/include/nuttx/list.h:47,
from nuttx/include/nuttx/tls.h:40,
from nuttx/include/nuttx/sched.h:48,
from nuttx/include/nuttx/arch.h:87,
from nuttx/include/nuttx/userspace.h:35,
from nuttx/include/nuttx/mm/mm.h:30,
from nuttx/include/nuttx/kmalloc.h:34,
from nuttx/include/nuttx/lib/lib.h:31,
from nuttx/include/stdio.h:35,
from apps/system/libuv/libuv/include/uv.h:59,
from libuv/src/unix/udp.c:22:
nuttx/include/nuttx/nuttx.h:48: note: this is the location of the previous definition
48 | #define container_of(ptr, type, member) \
|
Signed-off-by: chao an <anchao@lixiang.com>
The length of some config elements are not equal to 1,2,4,8, so we can't
assert in virtio_mmio_config_read/write() direclty when length != 1,2,4,8
For example, in virtio_net_config from virtio spec v1.2
struct virtio_net_config {
u8 mac[6];
le16 status;
le16 max_virtqueue_pairs;
le16 mtu;
le32 speed;
u8 duplex;
u8 rss_max_key_size;
le16 rss_max_indirection_table_length;
le32 supported_hash_types;
};
The mac length is 6 and not equal to 1,2,4,8
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Not found the mmio device is a normal case, so should not print the
error log.
This commit change the log level to info when not found the mmio
device.
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
-The qemu wifi fucntion only supports the STA mode and the following
operations:
wapi mode wlan0 2
wapi scan wlan0
wapi psk wlan0 password 3
wapi essid wlan0 wifi_name 1
wapi show wlan0
wapi disconnect wlan0
-Eanble the virtual wifi function with the MACRO `CONFIG_DRIVERS_WIFI_SIM`.
Signed-off-by: liqinhui <liqinhui@xiaomi.com>
Refers to https://docs.oasis-open.org/virtio/virtio/v1.2/cs01/virtio-v1.2-cs01.html#x1-2230004
A driver SHOULD negotiate VIRTIO_NET_F_MAC if the device offers it.
If the driver negotiates the VIRTIO_NET_F_MAC feature, the driver MUST
set the physical address of the NIC to mac. Otherwise, it SHOULD use a
locally-administered MAC address.
Signed-off-by: liqinhui <liqinhui@xiaomi.com>
Openamp/libmetal's metal io operation used the atomic operation, but
in QEMU 8.1.2, the risc-v IO region is not allow to use atomic instruction
in SMP case.
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>