mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-31 05:51:53 -06:00
hw/virtio: Add support for VDPA network simulation devices
This patch adds support for VDPA network simulation devices. The device is developed based on virtio-net and tap backend, and supports hardware live migration function. For more details, please refer to "docs/system/devices/vdpa-net.rst" Signed-off-by: Hao Chen <chenh@yusur.tech> Message-Id: <20240221073802.2888022-1-chenh@yusur.tech> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
043e127a12
commit
cd341fd1ff
9 changed files with 399 additions and 3 deletions
|
@ -3368,6 +3368,18 @@ static uint16_t virtio_queue_split_get_last_avail_idx(VirtIODevice *vdev,
|
|||
return vdev->vq[n].last_avail_idx;
|
||||
}
|
||||
|
||||
static uint32_t virtio_queue_split_get_vring_states(VirtIODevice *vdev,
|
||||
int n)
|
||||
{
|
||||
struct VirtQueue *vq = &vdev->vq[n];
|
||||
uint16_t avail, used;
|
||||
|
||||
avail = vq->last_avail_idx;
|
||||
used = vq->used_idx;
|
||||
|
||||
return avail | (uint32_t)used << 16;
|
||||
}
|
||||
|
||||
unsigned int virtio_queue_get_last_avail_idx(VirtIODevice *vdev, int n)
|
||||
{
|
||||
if (virtio_vdev_has_feature(vdev, VIRTIO_F_RING_PACKED)) {
|
||||
|
@ -3377,6 +3389,33 @@ unsigned int virtio_queue_get_last_avail_idx(VirtIODevice *vdev, int n)
|
|||
}
|
||||
}
|
||||
|
||||
unsigned int virtio_queue_get_vring_states(VirtIODevice *vdev, int n)
|
||||
{
|
||||
if (virtio_vdev_has_feature(vdev, VIRTIO_F_RING_PACKED)) {
|
||||
return -1;
|
||||
} else {
|
||||
return virtio_queue_split_get_vring_states(vdev, n);
|
||||
}
|
||||
}
|
||||
|
||||
static void virtio_queue_split_set_vring_states(VirtIODevice *vdev,
|
||||
int n, uint32_t idx)
|
||||
{
|
||||
struct VirtQueue *vq = &vdev->vq[n];
|
||||
vq->last_avail_idx = (uint16_t)(idx & 0xffff);
|
||||
vq->shadow_avail_idx = (uint16_t)(idx & 0xffff);
|
||||
vq->used_idx = (uint16_t)(idx >> 16);
|
||||
}
|
||||
|
||||
void virtio_queue_set_vring_states(VirtIODevice *vdev, int n, uint32_t idx)
|
||||
{
|
||||
if (virtio_vdev_has_feature(vdev, VIRTIO_F_RING_PACKED)) {
|
||||
return;
|
||||
} else {
|
||||
virtio_queue_split_set_vring_states(vdev, n, idx);
|
||||
}
|
||||
}
|
||||
|
||||
static void virtio_queue_packed_set_last_avail_idx(VirtIODevice *vdev,
|
||||
int n, unsigned int idx)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue