diff options
author | Hao Chen <chenh@yusur.tech> | 2024-02-21 15:38:02 +0800 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2024-03-12 17:56:55 -0400 |
commit | cd341fd1ffded978b2aa0b5309b00be7c42e347c (patch) | |
tree | f887d38d976a0f534cb967083551a65447fade98 /hw/net | |
parent | 043e127a126bb3ceb5fc753deee27d261fd0c5ce (diff) | |
download | qemu-cd341fd1ffded978b2aa0b5309b00be7c42e347c.zip qemu-cd341fd1ffded978b2aa0b5309b00be7c42e347c.tar.gz qemu-cd341fd1ffded978b2aa0b5309b00be7c42e347c.tar.bz2 |
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>
Diffstat (limited to 'hw/net')
-rw-r--r-- | hw/net/virtio-net.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index a3c711b..27055a4 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1999,6 +1999,22 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf, goto err; } + /* Mark dirty page's bitmap of guest memory */ + if (vdev->lm_logging_ctrl == LM_ENABLE) { + uint64_t chunk = elem->in_addr[i] / VHOST_LOG_CHUNK; + /* Get chunk index */ + BitmapMemoryRegionCaches *caches = qatomic_rcu_read(&vdev->caches); + uint64_t index = chunk / 8; + uint64_t shift = chunk % 8; + uint8_t val = 0; + address_space_read_cached(&caches->bitmap, index, &val, + sizeof(val)); + val |= 1 << shift; + address_space_write_cached(&caches->bitmap, index, &val, + sizeof(val)); + address_space_cache_invalidate(&caches->bitmap, index, sizeof(val)); + } + elems[i] = elem; lens[i] = total; i++; |