aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorlyx634449800 <yuxue.liu@jaguarmicro.com>2024-04-08 10:00:03 +0800
committerMichael Tokarev <mjt@tls.msk.ru>2024-04-09 20:42:59 +0300
commitcd461c8445392d02c268d79f7ed68387b440c4b3 (patch)
tree6206dd4f72c93e4c04bbf50b893a65dad58b9904 /hw
parentb57b102a81f7530644b79695335389e4c44d0dd9 (diff)
vdpa-dev: Fix the issue of device status not updating when configuration interruption is triggered
The set_config callback function vhost_vdpa_device_get_config in vdpa-dev does not fetch the current device status from the hardware device, causing the guest os to not receive the latest device status information. The hardware updates the config status of the vdpa device and then notifies the os. The guest os receives an interrupt notification, triggering a get_config access in the kernel, which then enters qemu internally. Ultimately, the vhost_vdpa_device_get_config function of vdpa-dev is called One scenario encountered is when the device needs to bring down the vdpa net device. After modifying the status field of virtio_net_config in the hardware, it sends an interrupt notification. However, the guest os always receives the STATUS field as VIRTIO_NET_S_LINK_UP. Signed-off-by: Yuxue Liu <yuxue.liu@jaguarmicro.com> Acked-by: Jason Wang <jasowang@redhat.com> Message-Id: <20240408020003.1979-1-yuxue.liu@jaguarmicro.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> (cherry picked from commit 6ae72f609a21cfc56bf655cd4bcded5d07691ce7) Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'hw')
-rw-r--r--hw/virtio/vdpa-dev.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/hw/virtio/vdpa-dev.c b/hw/virtio/vdpa-dev.c
index c9c6d6c611..74af1822c1 100644
--- a/hw/virtio/vdpa-dev.c
+++ b/hw/virtio/vdpa-dev.c
@@ -192,7 +192,14 @@ static void
vhost_vdpa_device_get_config(VirtIODevice *vdev, uint8_t *config)
{
VhostVdpaDevice *s = VHOST_VDPA_DEVICE(vdev);
+ int ret;
+ ret = vhost_dev_get_config(&s->dev, s->config, s->config_size,
+ NULL);
+ if (ret < 0) {
+ error_report("get device config space failed");
+ return;
+ }
memcpy(config, s->config, s->config_size);
}