All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	lyx634449800 <yuxue.liu@jaguarmicro.com>,
	"Jason Wang" <jasowang@redhat.com>,
	"Eugenio Pérez" <eperezma@redhat.com>,
	"Kevin Wolf" <kwolf@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>
Subject: [PULL 5/7] vdpa-dev: Fix the issue of device status not updating when configuration interruption is triggered
Date: Tue, 9 Apr 2024 03:32:27 -0400	[thread overview]
Message-ID: <6ae72f609a21cfc56bf655cd4bcded5d07691ce7.1712647890.git.mst@redhat.com> (raw)
In-Reply-To: <cover.1712647890.git.mst@redhat.com>

From: lyx634449800 <yuxue.liu@jaguarmicro.com>

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>
---
 hw/virtio/vdpa-dev.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/virtio/vdpa-dev.c b/hw/virtio/vdpa-dev.c
index 13e87f06f6..64b96b226c 100644
--- a/hw/virtio/vdpa-dev.c
+++ b/hw/virtio/vdpa-dev.c
@@ -195,7 +195,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);
 }
 
-- 
MST



  parent reply	other threads:[~2024-04-09  7:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-09  7:32 [PULL 0/7] virtio,pc,pci: bugfixes Michael S. Tsirkin
2024-04-09  7:32 ` [PULL 1/7] Revert "hw/virtio: Add support for VDPA network simulation devices" Michael S. Tsirkin
2024-04-09  7:32 ` [PULL 2/7] virtio-snd: Enhance error handling for invalid transfers Michael S. Tsirkin
2024-04-09  7:32 ` [PULL 3/7] virtio-snd: rewrite invalid tx/rx message handling Michael S. Tsirkin
2024-04-09  7:32 ` [PULL 4/7] hw/virtio: Fix packed virtqueue flush used_idx Michael S. Tsirkin
2024-04-09 17:40   ` Michael Tokarev
2024-04-10  5:31     ` Eugenio Perez Martin
2024-04-09  7:32 ` Michael S. Tsirkin [this message]
2024-04-09 17:43   ` [PULL 5/7] vdpa-dev: Fix the issue of device status not updating when configuration interruption is triggered Michael Tokarev
2024-04-09 18:06     ` Michael Tokarev
2024-04-09  7:32 ` [PULL 6/7] vhost-user-blk: simplify and fix vhost_user_blk_handle_config_change Michael S. Tsirkin
2024-04-09  7:32 ` [PULL 7/7] qdev-monitor: fix error message in find_device_state() Michael S. Tsirkin
2024-04-09 11:47 ` [PULL 0/7] virtio,pc,pci: bugfixes Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6ae72f609a21cfc56bf655cd4bcded5d07691ce7.1712647890.git.mst@redhat.com \
    --to=mst@redhat.com \
    --cc=eperezma@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=yuxue.liu@jaguarmicro.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.