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>
The RPMB partition cannot be accessed via standard block layer, but by a set of specific commands: WRITE, READ, GET_WRITE_COUNTER, and PROGRAM_KEY. Such a partition provides authenticated and replay protected access, hence suitable as a secure storage.
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
TCP receive tested with different IOB_BUFSIZE:
| | 256B vs 1534B | 512B vs 1534B | 768B vs 1534B |
| :---------: | :-----------: | :-----------: | :-----------: |
| Non-SMP | ~85% | ~93% | ~96% |
| armv8a-SMP | ~66% | ~84% | ~92% |
| rv32/64-SMP | ~52% | ~72% | ~83% |
It seems we still get performance penalty on smaller IOBs, and may be
affected more under SMP mode. It may be caused by critical sections in
IOB operations.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
Previously, the CONFIG_NET_LL_GUARDSIZE is fixed to 32 (64-Bit) or
28 (32-Bit), it's a little bit tricky.
Now add support to any value greater than minimal size.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
1. virtio devics/drivers match and probe/remote mechanism;
2. virtio mmio transport layer based on OpenAmp (Compatible with both
virtio mmio version 1 and 2);
3. virtio-serial driver based on new virtio framework;
4. virtio-rng driver based on new virtio framework;
5. virtio-net driver based on new virtio framework
(IOB Offload implementation);
6. virtio-blk driver based on new virtio framework;
7. Remove the old virtio mmio framework, the old framework only
support mmio transport layer, and the new framwork support
more transport layer and this commit has implemented all the
old virtio drivers;
8. Refresh the the qemu-arm64 and qemu-riscv virtio related
configs, and update its README.txt;
New virtio-net driver has better performance
Compared with previous virtio-mmio-net:
| | master/-c | master/-s | this/-c | this/-s |
| :--------------------: | :-------: | :-------: | :-----: | :-----: |
| qemu-armv8a:netnsh | 539Mbps | 524Mbps | 906Mbps | 715Mbps |
| qemu-armv8a:netnsh_smp | 401Mbps | 437Mbps | 583Mbps | 505Mbps |
| rv-virt:netnsh | 487Mbps | 512Mbps | 760Mbps | 634Mbps |
| rv-virt:netnsh_smp | 387Mbps | 455Mbps | 447Mbps | 502Mbps |
| rv-virt:netnsh64 | 602Mbps | 595Mbps | 881Mbps | 769Mbps |
| rv-virt:netnsh64_smp | 414Mbps | 515Mbps | 491Mbps | 525Mbps |
| rv-virt:knetnsh64 | 515Mbps | 457Mbps | 606Mbps | 540Mbps |
| rv-virt:knetnsh64_smp | 308Mbps | 389Mbps | 415Mbps | 474Mbps |
Note: Both CONFIG_IOB_NBUFFERS=64, using iperf command, all in Mbits/sec
Tested in QEMU 7.2.2
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
Summary:
- In this implementation, only one descriptor is used for RX.
- NOTE: we still use two descriptors for TX
Impact:
- None
Testing:
- Tested with qemu-7.1
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
Summary:
- I noticed that the driver sends incorrect packets sometimes.
- This commit fixes this issue.
Impact:
- None
Testing:
- Tested with qemu-7.1
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
Summary:
- This commit adds virtio-mmio-blk driver
Impact:
- None
Testing:
- Tested with rv-virt:netnsh which will be updated later
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>