aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugenio Pérez <eperezma@redhat.com>2023-12-15 18:28:19 +0100
committerMichael S. Tsirkin <mst@redhat.com>2023-12-26 04:51:07 -0500
commitbc865bfe2d54ac56daa20a6395abff68fab6a5d6 (patch)
tree316acc7f74980ecfbb67d00ca6dc081a14861a73
parent410cefbd5c3682432229f5905aa43358785d2ae0 (diff)
downloadqemu-bc865bfe2d54ac56daa20a6395abff68fab6a5d6.zip
qemu-bc865bfe2d54ac56daa20a6395abff68fab6a5d6.tar.gz
qemu-bc865bfe2d54ac56daa20a6395abff68fab6a5d6.tar.bz2
vdpa: do not set virtio status bits if unneeded
Next commits will set DRIVER and ACKNOWLEDGE flags repeatedly in the case of a migration destination. Let's save ioctls with this. Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Message-Id: <20231215172830.2540987-2-eperezma@redhat.com>
-rw-r--r--hw/virtio/vhost-vdpa.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index 819b2d8..401dfa9 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -511,6 +511,10 @@ static int vhost_vdpa_add_status(struct vhost_dev *dev, uint8_t status)
if (ret < 0) {
return ret;
}
+ if ((s & status) == status) {
+ /* Don't set bits already set */
+ return 0;
+ }
s |= status;